ci(deploy): cancel superseded main deploys, never a release (#1801)
This commit is contained in:
1 file changed
+27
-5
@@ -6,7 +6,7 @@ on:
|
|||||||
tags: ["v*"]
|
tags: ["v*"]
|
||||||
|
|
||||||
concurrency:
|
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
|
cancel-in-progress: true
|
||||||
|
|
||||||
permissions:
|
permissions:
|
||||||
@@ -14,10 +14,11 @@ permissions:
|
|||||||
packages: write
|
packages: write
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
gate:
|
plan:
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
outputs:
|
outputs:
|
||||||
archied_version: ${{ steps.release_tag.outputs.archied_version }}
|
archied_version: ${{ steps.release_tag.outputs.archied_version }}
|
||||||
|
run: ${{ steps.release_tag.outputs.run }}
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
@@ -34,6 +35,27 @@ jobs:
|
|||||||
else
|
else
|
||||||
echo "no release tag at HEAD; distribution zip will be skipped"
|
echo "no release tag at HEAD; distribution zip will be skipped"
|
||||||
fi
|
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
|
- name: Set up Go
|
||||||
uses: actions/setup-go@v5
|
uses: actions/setup-go@v5
|
||||||
@@ -212,8 +234,8 @@ jobs:
|
|||||||
cache-to: type=gha,mode=max,scope=archie-agent
|
cache-to: type=gha,mode=max,scope=archie-agent
|
||||||
|
|
||||||
dist-zip:
|
dist-zip:
|
||||||
needs: [gate, agent-image]
|
needs: [plan, gate, agent-image]
|
||||||
if: needs.gate.outputs.archied_version != ''
|
if: needs.plan.outputs.archied_version != ''
|
||||||
runs-on: self-hosted
|
runs-on: self-hosted
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout
|
- name: Checkout
|
||||||
@@ -242,7 +264,7 @@ jobs:
|
|||||||
|
|
||||||
- name: Resolve archied version
|
- name: Resolve archied version
|
||||||
id: 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
|
- name: Build linux/amd64 binaries
|
||||||
env:
|
env:
|
||||||
|
|||||||
Reference in new issue
Block a user