diff --git a/.github/workflows/go.yml b/.github/workflows/go.yml index 6217c46..cfbe58a 100644 --- a/.github/workflows/go.yml +++ b/.github/workflows/go.yml @@ -15,7 +15,7 @@ jobs: runs-on: ubuntu-latest steps: - name: Set up Go 1.x - uses: actions/setup-go@v2 + uses: actions/setup-go@v4 with: go-version: ^1.16 id: go @@ -51,24 +51,32 @@ jobs: - name: Set up QEMU if: startsWith(github.ref, 'refs/tags/') - uses: docker/setup-qemu-action@v1 - + uses: docker/setup-qemu-action@v2 + - name: Set up Docker Buildx if: startsWith(github.ref, 'refs/tags/') - id: buildx - uses: docker/setup-buildx-action@v1 + uses: docker/setup-buildx-action@v2 + + - name: Login to GHCR + if: startsWith(github.ref, 'refs/tags/') + uses: docker/login-action@v2 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} - - name: Build and push container image + - name: Build and push Docker image if: startsWith(github.ref, 'refs/tags/') - env: - QUAY_USER: ${{ secrets.QUAY_USER }} - QUAY_TOKEN: ${{ secrets.QUAY_TOKEN }} - run: | - docker login -u=$QUAY_USER -p=$QUAY_TOKEN quay.io - docker buildx build \ - --platform linux/arm/v7,linux/amd64,linux/arm64 \ - --tag quay.io/fhopfensperger/simple-go-app:latest \ - --tag quay.io/fhopfensperger/simple-go-app:$RELEASE_VERSION_WITHOUT_V \ - -f Dockerfile \ - --build-arg BUILD_VERSION=$RELEASE_VERSION_WITHOUT_V \ - --push . \ No newline at end of file + uses: docker/build-push-action@v4 + with: + context: . + file: ./Dockerfile + platforms: linux/amd64,linux/arm64 + push: true + build-args: | + BUILD_VERSION=${{ env.RELEASE_VERSION_WITHOUT_V }} + labels: | + org.opencontainers.image.source=https://github.com/${{ github.repository }} + tags: | + ghcr.io/${{ github.repository }}:latest + ghcr.io/${{ github.repository }}:${{ env.RELEASE_VERSION_WITHOUT_V }}