diff --git a/.github/workflows/build_and_publish.yml b/.github/workflows/build_and_publish.yml index 42f086c..cf1fa95 100644 --- a/.github/workflows/build_and_publish.yml +++ b/.github/workflows/build_and_publish.yml @@ -23,15 +23,6 @@ jobs: build: runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v4 - - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Build - uses: docker/setup-buildx-action@v3 - - name: Login to DockerHub if: ${{ inputs.publish }} uses: docker/login-action@v3 @@ -39,16 +30,42 @@ jobs: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} + - name: Login to GitHub Container registry + if: ${{ inputs.publish }} + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + + - name: Checkout + uses: actions/checkout@v4 + + - name: Set up QEMU + uses: docker/setup-qemu-action@v3 + + - name: Set up Docker Buildx + uses: docker/setup-buildx-action@v3 + - name: Configure target tags (with latest) if: ${{ inputs.update_latest }} - run: echo "TAGS=mumblevoip/mumble-server:latest, mumblevoip/mumble-server:${{ inputs.mumble_version }}, mumblevoip/mumble-server:${{ inputs.mumble_version }}-${{ inputs.docker_version }}" >> $GITHUB_ENV + run: echo "PRE_TAGS=mumble-server:latest mumble-server:${{ inputs.mumble_version }} mumble-server:${{ inputs.mumble_version }}-${{ inputs.docker_version }}" >> $GITHUB_ENV - name: Configure target tags (without latest) if: ${{ ! inputs.update_latest }} - run: echo "TAGS=mumblevoip/mumble-server:${{ inputs.mumble_version }}, mumblevoip/mumble-server:${{ inputs.mumble_version }}-${{ inputs.docker_version }}" >> $GITHUB_ENV + run: echo "PRE_TAGS=mumble-server:${{ inputs.mumble_version }} mumble-server:${{ inputs.mumble_version }}-${{ inputs.docker_version }}" >> $GITHUB_ENV + - name: Make tags for registries + run: | + TAG_ARRAY=() + for current in $PRE_TAGS; do + TAG_ARRAY+=("mumblevoip/$current" "ghcr.io/mumble-voip/$current") + done + TAGS="$( IFS=","; echo "${TAG_ARRAY[*]}" )" + echo "TAGS=$TAGS" >> $GITHUB_ENV + - name: Build and push - uses: docker/build-push-action@v5 + uses: docker/build-push-action@v6 with: context: . platforms: ${{ inputs.platforms }}