build(infra): also push Docker images to ghcr.io

This commit is contained in:
Jakob Borg 2024-10-26 16:22:38 +02:00
parent da58e5c50c
commit 69979996d9
No known key found for this signature in database

View File

@ -12,6 +12,10 @@ env:
BUILD_USER: docker BUILD_USER: docker
BUILD_HOST: github.syncthing.net BUILD_HOST: github.syncthing.net
permissions:
contents: read
packages: write
jobs: jobs:
docker-syncthing: docker-syncthing:
name: Build and push Docker images name: Build and push Docker images
@ -41,6 +45,13 @@ jobs:
username: ${{ secrets.DOCKERHUB_USERNAME }} username: ${{ secrets.DOCKERHUB_USERNAME }}
password: ${{ secrets.DOCKERHUB_TOKEN }} password: ${{ secrets.DOCKERHUB_TOKEN }}
- name: Login to GHCR
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build binaries - name: Build binaries
run: | run: |
for arch in arm64 amd64; do for arch in arm64 amd64; do
@ -53,13 +64,13 @@ jobs:
- name: Set Docker tags (all branches) - name: Set Docker tags (all branches)
run: | run: |
tags=syncthing/${{ matrix.pkg }}:${{ github.sha }} tags=docker.io/syncthing/${{ matrix.pkg }}:${{ github.sha }},ghcr.io/syncthing/infra/${{ matrix.pkg }}:${{ github.sha }}
echo "TAGS=$tags" >> $GITHUB_ENV echo "TAGS=$tags" >> $GITHUB_ENV
- name: Set Docker tags (latest) - name: Set Docker tags (latest)
if: github.ref == 'refs/heads/infrastructure' if: github.ref == 'refs/heads/infrastructure'
run: | run: |
tags=syncthing/${{ matrix.pkg }}:latest,${{ env.TAGS }} tags=docker.io/syncthing/${{ matrix.pkg }}:latest,ghcr.io/syncthing/infra/${{ matrix.pkg }}:latest,${{ env.TAGS }}
echo "TAGS=$tags" >> $GITHUB_ENV echo "TAGS=$tags" >> $GITHUB_ENV
- name: Build and push - name: Build and push