diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 5dc45885f..281f2c7da 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -6,7 +6,7 @@ on: tags: ["v*"] concurrency: - group: deploy-${{ github.sha }} + group: ${{ startsWith(github.ref, 'refs/tags/') && format('deploy-release-{0}', github.sha) || format('deploy-{0}', github.ref) }} cancel-in-progress: true permissions: @@ -14,10 +14,11 @@ permissions: packages: write jobs: - gate: + plan: runs-on: self-hosted outputs: archied_version: ${{ steps.release_tag.outputs.archied_version }} + run: ${{ steps.release_tag.outputs.run }} steps: - name: Checkout uses: actions/checkout@v4 @@ -34,6 +35,27 @@ jobs: else echo "no release tag at HEAD; distribution zip will be skipped" fi + run=true + case "$GITHUB_REF" in + refs/tags/*) ;; + *) + if [ -n "$version" ]; then + run=false + echo "the v$version tag push runs this commit; skipping the branch run" + fi + ;; + esac + echo "run=$run" >> "$GITHUB_OUTPUT" + + gate: + needs: plan + if: needs.plan.outputs.run == 'true' + runs-on: self-hosted + steps: + - name: Checkout + uses: actions/checkout@v4 + with: + fetch-depth: 0 - name: Set up Go uses: actions/setup-go@v5 @@ -212,8 +234,8 @@ jobs: cache-to: type=gha,mode=max,scope=archie-agent dist-zip: - needs: [gate, agent-image] - if: needs.gate.outputs.archied_version != '' + needs: [plan, gate, agent-image] + if: needs.plan.outputs.archied_version != '' runs-on: self-hosted steps: - name: Checkout @@ -242,7 +264,7 @@ jobs: - name: Resolve archied version id: version - run: echo "version=${{ needs.gate.outputs.archied_version }}" >> "$GITHUB_OUTPUT" + run: echo "version=${{ needs.plan.outputs.archied_version }}" >> "$GITHUB_OUTPUT" - name: Build linux/amd64 binaries env: