Skip to content

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

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

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

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
run: echo "tag=${GITHUB_REF#refs/*/}" >> $GITHUB_OUTPUT
- name: Extract tag name for PR
if: ${{ github.event_name != 'release' }}
id: vars

Check failure on line 22 in .github/workflows/build.yml

View workflow run for this annotation

GitHub Actions / Build

Invalid workflow file

The workflow is not valid. .github/workflows/build.yml (Line: 22, Col: 13): The identifier 'vars' may not be used more than once within the same scope.
run: |
TAG=${GITHUB_HEAD_REF#refs/*/}
TAG=${TAG//\/\#/-}
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 }}
tag_with_ref: true