Skip to content

Commit be78e7d

Browse files
lwshangclaude
andauthored
fix: avoid duplicate GitHub releases caused by race condition (#37)
Co-authored-by: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 65d701d commit be78e7d

1 file changed

Lines changed: 12 additions & 19 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ jobs:
2222
runs-on: ${{ matrix.os }}
2323
steps:
2424
- uses: actions/checkout@v4
25-
- uses: actions/cache@v3
25+
- uses: actions/cache@v4
2626
with:
2727
path: |
2828
~/.cargo/registry
@@ -49,8 +49,8 @@ jobs:
4949
uses: actions/upload-artifact@v4
5050
if: ${{ github.ref_type == 'tag' }}
5151
with:
52-
name: icp-cli-network-launcher-${{ matrix.relname }}-${{ env.VER }}
53-
path: dist/icp-cli-network-launcher-${{ matrix.relname }}-${{ env.VER }}.tar.gz
52+
name: icp-cli-network-launcher-${{ matrix.relname }}-${{ github.ref_name }}
53+
path: dist/icp-cli-network-launcher-${{ matrix.relname }}-${{ github.ref_name }}.tar.gz
5454

5555
aggregate:
5656
name: build:required
@@ -66,23 +66,18 @@ jobs:
6666
if: ${{ github.ref_type == 'tag' }}
6767
needs: build
6868
runs-on: ubuntu-latest
69-
strategy:
70-
matrix:
71-
relname: [x86_64-linux, arm64-linux, arm64-darwin, x86_64-darwin]
69+
permissions:
70+
contents: write
7271
steps:
73-
- name: Download build artifacts
72+
- name: Download all build artifacts
7473
uses: actions/download-artifact@v4
7574
with:
76-
name: icp-cli-network-launcher-${{ matrix.relname }}-${{ github.ref_name }}
77-
- name: Upload tarball and sha256
78-
uses: svenstaro/upload-release-action@v2
79-
with:
80-
repo_token: ${{ secrets.GITHUB_TOKEN }}
81-
file: icp-*.tar.*
82-
file_glob: true
83-
tag: ${{ github.ref_name }}
84-
prerelease: true
85-
make_latest: false
75+
pattern: icp-cli-network-launcher-*-${{ github.ref_name }}
76+
merge-multiple: true
77+
- name: Create release and upload assets
78+
env:
79+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
80+
run: gh release create "${{ github.ref_name }}" --repo "${{ github.repository }}" --prerelease icp-*.tar.*
8681

8782
docker-build:
8883
name: "Build Docker image for ${{ matrix.platform }}"
@@ -142,8 +137,6 @@ jobs:
142137

143138
- name: "Set up Docker Buildx"
144139
uses: docker/setup-buildx-action@v3
145-
with:
146-
install: true
147140

148141
- name: "Build and push ${{ matrix.platform }} image"
149142
id: build

0 commit comments

Comments
 (0)