Skip to content

Update ghrc-image.yml #5

Update ghrc-image.yml

Update ghrc-image.yml #5

Workflow file for this run

name: ghrc container Image CI
on:
push:
branches: [ "ghrc" ]
workflow_dispatch: # 允许手动触发 Workflow
inputs: # 可选的用户输入参数
buildType:
description: 'Build type (release/debug)'
required: true
default: 'release'
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push-image:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
attestations: write
id-token: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Set lowercase image name
id: set_image_name
run: echo "IMAGE_NAME=$(echo '${{ github.repository }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
- name: Log in to the Container registry
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
- name: Build and push Docker image
id: push
uses: docker/build-push-action@v5
with:
context: .
push: true
tags: |

Check failure on line 55 in .github/workflows/ghrc-image.yml

View workflow run for this annotation

GitHub Actions / ghrc container Image CI

Invalid workflow file

The workflow is not valid. .github/workflows/ghrc-image.yml (Line: 55, Col: 17): Unexpected symbol: '|'. Located at position 14 within expression: env.REGISTRY | toLower

Check failure on line 55 in .github/workflows/ghrc-image.yml

View workflow run for this annotation

GitHub Actions / ghrc container Image CI

Invalid workflow file

The workflow is not valid. .github/workflows/ghrc-image.yml (Line: 55, Col: 17): Unexpected symbol: '|'. Located at position 14 within expression: env.REGISTRY | toLower
${{ steps.meta.outputs.tags }}
${{ env.REGISTRY | toLower }}/${{ env.IMAGE_NAME }}:latest
labels: ${{ steps.meta.outputs.labels }}
- name: Generate artifact attestation
uses: actions/attest-build-provenance@v2
with:
subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
subject-digest: ${{ steps.push.outputs.digest }}
push-to-registry: true