Skip to content

Update build action to create a docker tags automatically for all branches #44

Update build action to create a docker tags automatically for all branches

Update build action to create a docker tags automatically for all branches #44

Workflow file for this run

# Build docker image
name: Build
on:
release:
types: [published]
pull_request:
jobs:
docker-image:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- 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=${{ github.event_name == 'release' && steps.vars-release.outputs.tag || steps.vars-pr.outputs.tag }}
tag_with_ref: true