Skip to content

Tag docker image as with latest tag on push to master #40

Tag docker image as with latest tag on push to master

Tag docker image as with latest tag on push to master #40

Workflow file for this run

name: Docker Image CI
on:
push:
branches: [ "master" ]
tags:
- 'v*'
pull_request:
branches: [ "master" ]
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Docker meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/ChameleonCloud/hammers
tags: |
type=sha
type=ref,event=branch
type=ref,event=tag
type=ref,event=pr
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push
uses: docker/build-push-action@v5
with:
push: ${{ github.event_name != 'pull_request' }}
labels: ${{ steps.meta.outputs.labels }}
tags: |

Check failure on line 43 in .github/workflows/docker-image.yml

View workflow run for this annotation

GitHub Actions / Docker Image CI

Invalid workflow file

The workflow is not valid. .github/workflows/docker-image.yml (Line: 43, Col: 15): Unrecognized function: 'if'. Located at position 1 within expression: if(github.ref == 'refs/heads/master' && github.event_name == 'push')
${{ steps.meta.outputs.tags }}
# Add 'latest' tag for master branch
${{ if(github.ref == 'refs/heads/master' && github.event_name == 'push') }} 'latest' ${{ else }} '' ${{ endif }}