Unverified Commit 40979a9b authored by Copilot's avatar Copilot Committed by GitHub
Browse files

Adjust Docker workflow for tag-based releases and weekly edge builds (#422)



* Initial plan

* feat: adjust Docker workflow for tag-based releases and weekly edge builds

- Trigger Docker builds on version tags (v*) instead of every main branch push
- Add weekly scheduled build (Sundays at 00:00 UTC) for edge images
- Configure proper image tagging:
  - Semver tags (version, major.minor, major) for tag pushes
  - 'latest' tag for version tag releases
  - 'edge' tag for scheduled/manual builds
- Ensure scheduled builds checkout main branch
- Update skip-check to handle scheduled and tag-based builds correctly

Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>

* refactor: improve Docker workflow clarity and correctness

- Simplify skip-check logic to only skip duplicates for workflow_dispatch
- Add explicit ref handling for scheduled builds vs other triggers
- Enable semver tag patterns conditionally only for version tags
- Remove redundant event_name check for latest tag

Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>

---------

Co-authored-by: default avatarcopilot-swe-agent[bot] <198982749+Copilot@users.noreply.github.com>
Co-authored-by: default avatarNugine <30099658+Nugine@users.noreply.github.com>
Co-authored-by: default avatarNugine <nugine@foxmail.com>
parent 2d8410c9
Loading
Loading
Loading
Loading
+15 −7
Original line number Diff line number Diff line
@@ -2,8 +2,11 @@ name: Docker

on:
  push:
    branches:
      - main
    tags:
      - "v*"
  schedule:
    # Run weekly on Sundays at 00:00 UTC
    - cron: '0 0 * * 0'
  workflow_dispatch:

env:
@@ -23,6 +26,8 @@ jobs:
        with:
          cancel_others: true
          paths_ignore: '["*.md"]'
          # Don't skip scheduled or tag-based builds
          skip_after_successful_duplicate: ${{ github.event_name == 'workflow_dispatch' }}
  
  build:
    needs: skip-check
@@ -40,6 +45,9 @@ jobs:
            arch: arm64
    steps:
      - uses: actions/checkout@v4
        with:
          # For scheduled builds, checkout main branch; otherwise use the triggering ref
          ref: ${{ github.event_name == 'schedule' && 'main' || github.ref }}
      - name: Prepare
        run: |
          platform=${{ matrix.platform }}
@@ -114,11 +122,11 @@ jobs:
        with:
          images: ${{ env.REGISTRY_IMAGE }}
          tags: |
            type=ref,event=branch
            type=ref,event=pr
            type=semver,pattern={{version}}
            type=semver,pattern={{major}}.{{minor}}
            type=raw,value=latest,enable={{is_default_branch}}
            type=semver,pattern={{version}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
            type=semver,pattern={{major}}.{{minor}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
            type=semver,pattern={{major}},enable=${{ startsWith(github.ref, 'refs/tags/v') }}
            type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }}
            type=raw,value=edge,enable=${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }}

      - name: Create manifest list and push
        working-directory: ${{ runner.temp }}/digests