From 3324ec1aa35a4b29f9ec6fc135c31611bc32e9ec Mon Sep 17 00:00:00 2001 From: Askaholic Date: Sat, 23 Nov 2024 19:02:13 -0500 Subject: [PATCH] Update build action to create docker tag on PRs --- .github/workflows/build.yml | 23 ++++++++++++++--------- 1 file changed, 14 insertions(+), 9 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 2739d36ba..f455b316f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -4,6 +4,7 @@ name: Build on: release: types: [published] + pull_request: jobs: docker-image: @@ -11,15 +12,19 @@ jobs: steps: - uses: actions/checkout@v3 - - name: Extract tag name - id: vars - run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT - - - name: Build and publish docker image - uses: docker/build-push-action@v1.1.1 + - name: Login to Docker Hub + uses: docker/login-action@v3 with: - repository: faforever/faf-python-server username: ${{ secrets.DOCKER_USERNAME }} password: ${{ secrets.DOCKER_PASSWORD }} - build_args: GITHUB_REF=${{ steps.vars.outputs.tag }} - tag_with_ref: true + + - name: Docker auto tag + id: meta + uses: docker/metadata-action@v5 + with: + images: faforever/faf-python-server + + - name: Build and publish docker image + uses: docker/build-push-action@v6 + with: + build-args: GITHUB_REF=${{ github.event_name == 'release' && github.ref_name || github.head_ref }}