58 lines
1.9 KiB
YAML
58 lines
1.9 KiB
YAML
name: build-weekly
|
|
|
|
on:
|
|
schedule:
|
|
- cron: '0 8 * * 0' # 每周日 UTC 8:00 (北京时间 16:00)
|
|
workflow_dispatch: # 支持手动触发
|
|
|
|
permissions:
|
|
contents: read
|
|
packages: write
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
run: |
|
|
git init .
|
|
git remote add origin "${GITHUB_SERVER_URL%/}/${GITHUB_REPOSITORY}.git"
|
|
git -c http.extraheader="Authorization: token ${{ secrets.CHECKOUT_TOKEN }}" \
|
|
fetch --depth=1 origin "${GITHUB_SHA}"
|
|
git checkout --force FETCH_HEAD
|
|
|
|
- name: Set up QEMU (for multi-arch build)
|
|
run: docker run --privileged --rm tonistiigi/binfmt --install all
|
|
|
|
- name: Set up Docker Buildx
|
|
run: |
|
|
docker buildx create --use --driver docker-container --name builder 2>/dev/null || true
|
|
docker buildx inspect --bootstrap
|
|
|
|
- name: Build image (multi-arch, export to daemon)
|
|
run: |
|
|
docker buildx build \
|
|
--platform linux/amd64,linux/arm64 \
|
|
--load \
|
|
-t luochen570-cli:latest \
|
|
.
|
|
|
|
- name: Install skopeo
|
|
run: |
|
|
apt-get update -qq && apt-get install -y -qq skopeo
|
|
|
|
- name: Push to Gitea internal registry (via skopeo, bypass Traefik)
|
|
run: |
|
|
GITEA_INTERNAL="gitea-http.gitea.svc.cluster.local:3000"
|
|
TAG_WEEKLY="weekly-$(date +%Y%m%d)"
|
|
skopeo copy \
|
|
docker-daemon:luochen570-cli:latest \
|
|
"docker://${GITEA_INTERNAL}/luochen570/luochen570-cli:latest" \
|
|
--dest-creds="luochen570:${{ secrets.CHECKOUT_TOKEN }}" \
|
|
--dest-tls-verify=false
|
|
skopeo copy \
|
|
docker-daemon:luochen570-cli:latest \
|
|
"docker://${GITEA_INTERNAL}/luochen570/luochen570-cli:${TAG_WEEKLY}" \
|
|
--dest-creds="luochen570:${{ secrets.CHECKOUT_TOKEN }}" \
|
|
--dest-tls-verify=false
|