Skip to content

Commit d638317

Browse files
committed
fix: release creation
1 parent 08b0ac8 commit d638317

File tree

1 file changed

+30
-14
lines changed

1 file changed

+30
-14
lines changed

.github/workflows/build-multi-platform-binary.yml

Lines changed: 30 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,31 @@ on:
99
- '*'
1010

1111
jobs:
12+
create-release:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
tag_name: ${{ steps.get-tag.outputs.tag_name }}
16+
release_id: ${{ steps.check-release.outputs.release_id }}
17+
18+
steps:
19+
- name: Checkout repository
20+
uses: actions/checkout@v4
21+
with:
22+
fetch-depth: 0
23+
24+
- name: Get latest tag and checkout
25+
id: get-tag
26+
run: ./.github/workflows/scripts/build-multi-platform-binary/get-latest-tag.sh
27+
28+
- name: Check or create release
29+
id: check-release
30+
env:
31+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
32+
TAG_NAME: ${{ steps.get-tag.outputs.tag_name }}
33+
run: node ./.github/workflows/scripts/build-multi-platform-binary/check-release.js
34+
1235
build-binary:
36+
needs: create-release
1337
strategy:
1438
matrix:
1539
include:
@@ -33,23 +57,15 @@ jobs:
3357
with:
3458
fetch-depth: 0
3559

36-
- name: Get latest tag and checkout
37-
id: get-tag
38-
run: ./.github/workflows/scripts/build-multi-platform-binary/get-latest-tag.sh
39-
40-
- name: Check or create release
41-
id: check-release
42-
env:
43-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
44-
TAG_NAME: ${{ steps.get-tag.outputs.tag_name }}
45-
run: node ./.github/workflows/scripts/build-multi-platform-binary/check-release.js
60+
- name: Checkout tag
61+
run: git checkout ${{ needs.create-release.outputs.tag_name }}
4662

4763
- name: Check if asset already exists
4864
id: check-asset
4965
env:
5066
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51-
RELEASE_ID: ${{ steps.check-release.outputs.release_id }}
52-
TAG_NAME: ${{ steps.get-tag.outputs.tag_name }}
67+
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
68+
TAG_NAME: ${{ needs.create-release.outputs.tag_name }}
5369
PLATFORM: ${{ matrix.platform }}
5470
ARCH: ${{ matrix.arch }}
5571
run: node ./.github/workflows/scripts/build-multi-platform-binary/check-asset.js
@@ -58,7 +74,7 @@ jobs:
5874
id: build
5975
if: steps.check-asset.outputs.asset_exists == 'false'
6076
env:
61-
TAG_NAME: ${{ steps.get-tag.outputs.tag_name }}
77+
TAG_NAME: ${{ needs.create-release.outputs.tag_name }}
6278
PLATFORM: ${{ matrix.platform }}
6379
ARCH: ${{ matrix.arch }}
6480
run: ./.github/workflows/scripts/build-multi-platform-binary/build-binary.sh
@@ -67,7 +83,7 @@ jobs:
6783
if: steps.build.conclusion == 'success'
6884
env:
6985
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
70-
RELEASE_ID: ${{ steps.check-release.outputs.release_id }}
86+
RELEASE_ID: ${{ needs.create-release.outputs.release_id }}
7187
ASSET_PATH: ${{ steps.build.outputs.asset_path }}
7288
ASSET_NAME: ${{ steps.build.outputs.asset_name }}
7389
run: node ./.github/workflows/scripts/build-multi-platform-binary/upload-asset.js

0 commit comments

Comments
 (0)