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 36bd19f
Showing 1 changed file with 20 additions and 8 deletions.
28 changes: 20 additions & 8 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,22 +4,34 @@ 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
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- 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 tag
id: meta
uses: docker/metadata-action@v5
with:
images: faforever/faf-python-server
tags:
type=ref,event=tag
type=ref,event=pr

- 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 }}
tags: ${{ steps.meta.outputs.tags }}

0 comments on commit 36bd19f

Please sign in to comment.