Skip to content

Fix env variable in workflows #3

Fix env variable in workflows

Fix env variable in workflows #3

name: Docker Dev Image CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
IMAGE_TAG: ${{ GITHUB_REF_SLUG }}

Check failure on line 12 in .github/workflows/docker-dev-image.yaml

View workflow run for this annotation

GitHub Actions / Docker Dev Image CI

Invalid workflow file

The workflow is not valid. .github/workflows/docker-dev-image.yaml (Line: 12, Col: 14): Unrecognized named-value: 'GITHUB_REF_SLUG'. Located at position 1 within expression: GITHUB_REF_SLUG
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- uses: actions/checkout@v4
- name: Inject slug/short variables
uses: rlespinasse/github-slug-action@v4
- name: Log in to the Container registry
uses: docker/login-action@v3
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v6
with:
context: .
file: docker/Dockerfile
target: app-dev
push: true
tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}:${{ env.IMAGE_TAG }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v1
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true