Skip to content

Commit

Permalink
Update build action to create docker tag on PRs
Browse files Browse the repository at this point in the history
  • Loading branch information
Askaholic committed Nov 24, 2024
1 parent 0a667d2 commit b331cd7
Showing 1 changed file with 14 additions and 3 deletions.
17 changes: 14 additions & 3 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,33 @@ name: Build
on:
release:
types: [published]
pull_request:

jobs:
docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Extract tag name
id: vars
- name: Extract tag name for release
if: ${{ github.event_name == 'release' }}
id: vars-release
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT

- name: Extract tag name for PR
if: ${{ github.event_name != 'release' }}
id: vars-pr
run: |
TAG=${GITHUB_HEAD_REF//\/\#/-}
TAG=${TAG//\//-}
TAG=${TAG//\#/-}
echo "tag=$TAG" >> $GITHUB_OUTPUT
- name: Build and publish docker image
uses: docker/[email protected]
with:
repository: faforever/faf-python-server
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
build_args: GITHUB_REF=${{ steps.vars.outputs.tag }}
build_args: GITHUB_REF=${{ steps.vars-release.outputs.tag || steps.vars-pr.outputs.tag }}
tag_with_ref: true

0 comments on commit b331cd7

Please sign in to comment.