Files
xread/.github/workflows/image.yml
T
xixu-me c0b04320e1 fix(ci): repair github actions runners
Use the repository-installed TypeScript compiler in CI tests and restore docker/setup-buildx-action so the container workflow can use the GitHub Actions cache backend.
2026-03-30 00:39:24 +08:00

75 lines
2.0 KiB
YAML

name: Container Image
on:
pull_request:
paths:
- Dockerfile
- package.json
- package-lock.json
- tsconfig.json
- integrity-check.cjs
- src/**
- public/**
- licensed/**
- scripts/**
- .github/workflows/image.yml
push:
branches:
- main
tags:
- v*
workflow_dispatch:
permissions:
contents: read
packages: write
concurrency:
group: image-${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
docker:
name: Build container image
runs-on: ubuntu-latest
timeout-minutes: 45
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Derive image name
id: vars
run: echo "image_name=ghcr.io/${GITHUB_REPOSITORY,,}" >> "$GITHUB_OUTPUT"
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Extract image metadata
id: meta
uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7
with:
images: ${{ steps.vars.outputs.image_name }}
tags: |
type=ref,event=branch
type=ref,event=tag
type=sha,prefix=sha-
type=raw,value=latest,enable={{is_default_branch}}
- name: Log in to GitHub Container Registry
if: github.event_name != 'pull_request'
uses: docker/login-action@65b78e6e13532edd9afa3aa52ac7964289d1a9c1
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Build and optionally publish image
uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4
with:
context: .
push: ${{ github.event_name != 'pull_request' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max