Skip to content

refactor: comprehensive codebase optimization and restructuring #17

refactor: comprehensive codebase optimization and restructuring

refactor: comprehensive codebase optimization and restructuring #17

Workflow file for this run

name: Build and publish docker container

Check failure on line 1 in .github/workflows/docker-publish.yml

View workflow run for this annotation

GitHub Actions / .github/workflows/docker-publish.yml

Invalid workflow file

(Line: 65, Col: 9): Unexpected value 'strategy'
on:
schedule:
- cron: '30 15 * * *' # 每天 UTC 15:30(=北京 23:30)
release:
types: [published]
workflow_dispatch:
jobs:
publish:
name: Publish container image
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Check pushes today (UTC+8)
id: check_push
run: |
git fetch origin
TZ=Asia/Shanghai
since=$(date -d 'today 00:00' +"%Y-%m-%dT%H:%M:%S")
if git log --since="$since" --format=oneline origin/main origin/refactor | head -n 1; then
echo "has_push=true" >> "$GITHUB_OUTPUT"
else
echo "has_push=false" >> "$GITHUB_OUTPUT"
fi
- name: OCI meta
id: meta
uses: docker/metadata-action@v5
with:
images: ghcr.io/${{ github.repository }}
flavor: |
latest=${{ matrix.node-version == 24 && 'true' || 'false' }}
suffix=${{ matrix.node-version == 25 && '-node-25' || '' }}
tags: |
type=ref,event=branch
type=ref,event=pr
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=sha
- name: Set up QEMU
uses: docker/setup-qemu-action@v3
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3
- name: Login to GHCR
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
if: github.event_name != 'schedule' || steps.check_push.outputs.has_push == 'true'
strategy:
matrix:
node-version: [24, 25]
with:
context: .
push: ${{ github.event_name != 'pull_request' && github.actor != 'dependabot[bot]' }}
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
platforms: linux/amd64,linux/arm64
cache-from: type=gha
cache-to: type=gha,mode=max
build-args: |
REPO=${{ github.repository }}
REF=${{ github.ref }}
COMMIT=${{ github.sha }}
USE_MIRROR=false
NODE_VERSION=${{ matrix.node-version }}-slim
secrets: |
npmrc=//npm.pkg.github.com/:_authToken=${{ secrets.GPR_TOKEN }}