|
| 1 | +# LinaPro nightly multi-platform Docker image publishing workflow. |
| 2 | +# GitHub cron uses UTC. 16:00 UTC is 00:00 Asia/Shanghai. |
| 3 | +name: Nightly Build |
| 4 | + |
| 5 | +on: |
| 6 | + schedule: |
| 7 | + - cron: "0 16 * * *" |
| 8 | + |
| 9 | + workflow_dispatch: |
| 10 | + |
| 11 | +permissions: |
| 12 | + contents: read |
| 13 | + packages: write |
| 14 | + |
| 15 | +concurrency: |
| 16 | + group: "${{ github.workflow }} @ nightly" |
| 17 | + cancel-in-progress: false |
| 18 | + |
| 19 | +env: |
| 20 | + TZ: "Asia/Shanghai" |
| 21 | + IMAGE_NAME: "linapro" |
| 22 | + PLATFORMS: "linux/amd64,linux/arm64" |
| 23 | + |
| 24 | +jobs: |
| 25 | + nightly-image: |
| 26 | + name: Build and publish nightly image |
| 27 | + runs-on: ubuntu-latest |
| 28 | + timeout-minutes: 90 |
| 29 | + |
| 30 | + steps: |
| 31 | + - name: Checkout Repository |
| 32 | + uses: actions/checkout@v5 |
| 33 | + |
| 34 | + - name: Setup Go |
| 35 | + uses: actions/setup-go@v5 |
| 36 | + with: |
| 37 | + go-version: "1.25" |
| 38 | + cache-dependency-path: "**/go.sum" |
| 39 | + |
| 40 | + - name: Setup pnpm |
| 41 | + uses: pnpm/action-setup@v4 |
| 42 | + with: |
| 43 | + version: "10.30.3" |
| 44 | + run_install: false |
| 45 | + |
| 46 | + - name: Setup Node |
| 47 | + uses: actions/setup-node@v5 |
| 48 | + with: |
| 49 | + node-version-file: "apps/lina-vben/.node-version" |
| 50 | + cache: "pnpm" |
| 51 | + cache-dependency-path: "apps/lina-vben/pnpm-lock.yaml" |
| 52 | + |
| 53 | + - name: Install Frontend Dependencies |
| 54 | + working-directory: apps/lina-vben |
| 55 | + run: pnpm install --frozen-lockfile |
| 56 | + |
| 57 | + - name: Setup QEMU |
| 58 | + uses: docker/setup-qemu-action@v3 |
| 59 | + |
| 60 | + - name: Setup Docker Buildx |
| 61 | + uses: docker/setup-buildx-action@v3 |
| 62 | + |
| 63 | + - name: Login to GHCR |
| 64 | + uses: docker/login-action@v3 |
| 65 | + with: |
| 66 | + registry: ghcr.io |
| 67 | + username: ${{ github.actor }} |
| 68 | + password: ${{ secrets.GITHUB_TOKEN }} |
| 69 | + |
| 70 | + - name: Prepare Image Metadata |
| 71 | + id: image |
| 72 | + run: | |
| 73 | + owner="$(printf '%s' "${GITHUB_REPOSITORY_OWNER}" | tr '[:upper:]' '[:lower:]')" |
| 74 | + image_name="$(printf '%s' "${IMAGE_NAME}" | tr '[:upper:]' '[:lower:]')" |
| 75 | + registry="ghcr.io/${owner}" |
| 76 | + date_tag="nightly-$(date +'%Y%m%d')" |
| 77 | + image_ref="${registry}/${image_name}" |
| 78 | +
|
| 79 | + { |
| 80 | + echo "registry=${registry}" |
| 81 | + echo "image_name=${image_name}" |
| 82 | + echo "date_tag=${date_tag}" |
| 83 | + echo "image_ref=${image_ref}" |
| 84 | + } >> "${GITHUB_OUTPUT}" |
| 85 | +
|
| 86 | + echo "Publishing ${image_ref}:${date_tag} for ${PLATFORMS}" |
| 87 | +
|
| 88 | + - name: Build and Push Multi-Platform Image |
| 89 | + run: | |
| 90 | + make image \ |
| 91 | + config=".github/workflows/nightly-build/config.yaml" \ |
| 92 | + platforms="${PLATFORMS}" \ |
| 93 | + registry="${{ steps.image.outputs.registry }}" \ |
| 94 | + image="${{ steps.image.outputs.image_name }}" \ |
| 95 | + tag="${{ steps.image.outputs.date_tag }}" \ |
| 96 | + push=1 |
| 97 | +
|
| 98 | + - name: Publish Floating Nightly Tag |
| 99 | + run: | |
| 100 | + docker buildx imagetools create \ |
| 101 | + --tag "${{ steps.image.outputs.image_ref }}:nightly" \ |
| 102 | + "${{ steps.image.outputs.image_ref }}:${{ steps.image.outputs.date_tag }}" |
| 103 | +
|
| 104 | + - name: Inspect Published Manifest |
| 105 | + run: | |
| 106 | + docker buildx imagetools inspect "${{ steps.image.outputs.image_ref }}:${{ steps.image.outputs.date_tag }}" |
0 commit comments