2023-07-01 05:53:04 +00:00
|
|
|
name: Build Infrastructure Images
|
|
|
|
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- infrastructure
|
2024-01-13 10:19:09 +00:00
|
|
|
- infra-*
|
2023-07-01 05:53:04 +00:00
|
|
|
|
|
|
|
env:
|
2023-12-06 08:02:12 +00:00
|
|
|
GO_VERSION: "~1.21.5"
|
2023-11-14 06:46:14 +00:00
|
|
|
CGO_ENABLED: "0"
|
|
|
|
BUILD_USER: docker
|
|
|
|
BUILD_HOST: github.syncthing.net
|
2023-07-01 05:53:04 +00:00
|
|
|
|
|
|
|
jobs:
|
|
|
|
docker-syncthing:
|
|
|
|
name: Build and push Docker images
|
2024-01-13 10:19:09 +00:00
|
|
|
if: github.repository == 'syncthing/syncthing'
|
2023-07-01 05:53:04 +00:00
|
|
|
runs-on: ubuntu-latest
|
|
|
|
environment: docker
|
|
|
|
strategy:
|
2023-11-14 06:46:14 +00:00
|
|
|
matrix:
|
|
|
|
pkg:
|
|
|
|
- stcrashreceiver
|
|
|
|
- strelaypoolsrv
|
|
|
|
- stupgrades
|
2023-11-15 07:46:11 +00:00
|
|
|
- ursrv
|
2023-07-01 05:53:04 +00:00
|
|
|
steps:
|
2023-09-05 07:52:19 +00:00
|
|
|
- uses: actions/checkout@v4
|
2023-07-01 05:53:04 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
|
2023-12-11 20:38:46 +00:00
|
|
|
- uses: actions/setup-go@v5
|
2023-12-06 08:02:12 +00:00
|
|
|
with:
|
|
|
|
go-version: ${{ env.GO_VERSION }}
|
|
|
|
check-latest: true
|
|
|
|
|
2023-07-01 05:53:04 +00:00
|
|
|
- name: Login to Docker Hub
|
2023-09-25 19:50:17 +00:00
|
|
|
uses: docker/login-action@v3
|
2023-07-01 05:53:04 +00:00
|
|
|
with:
|
|
|
|
username: ${{ secrets.DOCKERHUB_USERNAME }}
|
|
|
|
password: ${{ secrets.DOCKERHUB_TOKEN }}
|
|
|
|
|
|
|
|
- name: Build binaries
|
|
|
|
run: |
|
|
|
|
for arch in arm64 amd64; do
|
|
|
|
go run build.go -goos linux -goarch "$arch" build ${{ matrix.pkg }}
|
|
|
|
mv ${{ matrix.pkg }} ${{ matrix.pkg }}-linux-"$arch"
|
|
|
|
done
|
|
|
|
|
|
|
|
- name: Set up Docker Buildx
|
2023-09-25 19:50:17 +00:00
|
|
|
uses: docker/setup-buildx-action@v3
|
2023-07-01 05:53:04 +00:00
|
|
|
|
2024-01-13 10:19:09 +00:00
|
|
|
- name: Set Docker tags (all branches)
|
|
|
|
run: |
|
|
|
|
tags=syncthing/${{ matrix.pkg }}:${{ github.sha }}
|
|
|
|
echo "TAGS=$tags" >> $GITHUB_ENV
|
|
|
|
|
|
|
|
- name: Set Docker tags (latest)
|
|
|
|
if: github.ref == 'refs/heads/infrastructure'
|
|
|
|
run: |
|
|
|
|
tags=syncthing/${{ matrix.pkg }}:latest,${{ env.TAGS }}
|
|
|
|
echo "TAGS=$tags" >> $GITHUB_ENV
|
|
|
|
|
2023-07-01 05:53:04 +00:00
|
|
|
- name: Build and push
|
2023-09-25 19:50:17 +00:00
|
|
|
uses: docker/build-push-action@v5
|
2023-07-01 05:53:04 +00:00
|
|
|
with:
|
|
|
|
context: .
|
|
|
|
file: ./Dockerfile.${{ matrix.pkg }}
|
|
|
|
platforms: linux/amd64,linux/arm64
|
|
|
|
push: true
|
2024-01-13 10:19:09 +00:00
|
|
|
tags: ${{ env.TAGS }}
|
2023-11-14 07:17:34 +00:00
|
|
|
labels: |
|
|
|
|
org.opencontainers.image.revision=${{ github.sha }}
|