|
11 | 11 | required: true |
12 | 12 | type: string |
13 | 13 |
|
| 14 | +concurrency: |
| 15 | + group: release-${{ github.workflow }}-${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }} |
| 16 | + cancel-in-progress: false |
| 17 | + |
14 | 18 | permissions: |
15 | 19 | contents: write |
16 | 20 |
|
|
23 | 27 | fetch-depth: 0 |
24 | 28 | ref: ${{ github.event_name == 'workflow_dispatch' && format('refs/tags/{0}', inputs.tag) || github.ref }} |
25 | 29 |
|
| 30 | + |
| 31 | + - name: Resolve release tag |
| 32 | + id: tag |
| 33 | + run: | |
| 34 | + if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then |
| 35 | + echo "name=${{ inputs.tag }}" >> "$GITHUB_OUTPUT" |
| 36 | + else |
| 37 | + echo "name=${GITHUB_REF#refs/tags/}" >> "$GITHUB_OUTPUT" |
| 38 | + fi |
| 39 | +
|
| 40 | + - name: Check if release already published |
| 41 | + id: published |
| 42 | + env: |
| 43 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 44 | + run: | |
| 45 | + COUNT=$(gh release view "${{ steps.tag.outputs.name }}" \ |
| 46 | + --json assets -q '.assets | length' 2>/dev/null || echo 0) |
| 47 | + echo "asset_count=$COUNT" >> "$GITHUB_OUTPUT" |
| 48 | + if [ "$COUNT" -ge 6 ]; then |
| 49 | + echo "skip=true" >> "$GITHUB_OUTPUT" |
| 50 | + else |
| 51 | + echo "skip=false" >> "$GITHUB_OUTPUT" |
| 52 | + fi |
| 53 | +
|
| 54 | + - name: Release already published |
| 55 | + if: steps.published.outputs.skip == 'true' |
| 56 | + run: | |
| 57 | + echo "Release ${{ steps.tag.outputs.name }} already has ${{ steps.published.outputs.asset_count }} assets — skipping publish" |
26 | 58 | - name: Checkout cimis-tsdb dependency |
27 | 59 | uses: actions/checkout@v7 |
28 | 60 | with: |
|
31 | 63 | token: ${{ secrets.GH_PAT }} |
32 | 64 |
|
33 | 65 | - name: Set up Go |
| 66 | + if: steps.published.outputs.skip != 'true' |
34 | 67 | uses: actions/setup-go@v6 |
35 | 68 | with: |
36 | 69 | go-version-file: 'go.mod' |
|
45 | 78 | GOPRIVATE: github.com/dl-alexandre/* |
46 | 79 |
|
47 | 80 | - name: Run GoReleaser |
| 81 | + if: steps.published.outputs.skip != 'true' |
48 | 82 | uses: goreleaser/goreleaser-action@v7 |
49 | 83 | with: |
50 | 84 | distribution: goreleaser |
|
0 commit comments