Skip to content

Use container in ci

Use container in ci #9

Workflow file for this run

name: CI
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}-pr${{ github.event.pull_request.number }}
jobs:
prepare-container:
runs-on: ubuntu-latest
steps:
- uses: docker/login-action@v3
with:
registry: ${{ env.CONTAINER_REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- uses: docker/metadata-action@v5
id: meta
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- uses: docker/build-push-action@v5
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
build:
needs: prepare-container
runs-on: ubuntu-latest
container:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}

Check failure on line 36 in .github/workflows/ci.yaml

View workflow run for this annotation

GitHub Actions / CI

Invalid workflow file

The workflow is not valid. .github/workflows/ci.yaml (Line: 36, Col: 14): Unrecognized named-value: 'env'. Located at position 1 within expression: env.REGISTRY .github/workflows/ci.yaml (Line: 47, Col: 14): Unrecognized named-value: 'env'. Located at position 1 within expression: env.REGISTRY
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: make build
- run: make run args=-help
test:
needs: prepare-container
runs-on: ubuntu-latest
container:
image: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
credentials:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
steps:
- run: make test