Skip to content

Commit 154fed9

Browse files
committed
feat: enhance release workflow to create draft releases with dynamic tagging
1 parent 58f394d commit 154fed9

1 file changed

Lines changed: 28 additions & 10 deletions

File tree

.github/workflows/release.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,34 @@ env:
99
APP_NAME: fetch-github-hosts
1010

1111
jobs:
12+
create-release:
13+
permissions:
14+
contents: write
15+
runs-on: ubuntu-latest
16+
outputs:
17+
release_id: ${{ steps.create.outputs.result }}
18+
steps:
19+
- uses: actions/checkout@v4
20+
- name: Create draft release
21+
id: create
22+
uses: actions/github-script@v7
23+
with:
24+
script: |
25+
const tagName = context.ref.replace('refs/tags/', '') || 'v4.0';
26+
const { data } = await github.rest.repos.createRelease({
27+
owner: context.repo.owner,
28+
repo: context.repo.repo,
29+
tag_name: tagName,
30+
name: `Fetch Github Hosts ${tagName}`,
31+
body: `See the assets below to download the app for your platform.\n\n**macOS**: \`.dmg\` (Universal binary - supports both Intel & Apple Silicon)\n**Windows**: \`.msi\` / \`.exe\`\n**Linux**: \`.deb\` / \`.AppImage\``,
32+
draft: true,
33+
prerelease: false
34+
});
35+
return data.id;
36+
result-encoding: string
37+
1238
build-tauri:
39+
needs: create-release
1340
permissions:
1441
contents: write
1542
strategy:
@@ -83,14 +110,5 @@ jobs:
83110
env:
84111
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
85112
with:
86-
tagName: ${{ github.ref_name }}
87-
releaseName: 'Fetch Github Hosts ${{ github.ref_name }}'
88-
releaseBody: |
89-
See the assets below to download the app for your platform.
90-
91-
**macOS**: `.dmg` (Universal binary - supports both Intel & Apple Silicon)
92-
**Windows**: `.msi` / `.exe`
93-
**Linux**: `.deb` / `.AppImage`
94-
releaseDraft: true
95-
prerelease: false
113+
releaseId: ${{ needs.create-release.outputs.release_id }}
96114
args: ${{ matrix.args }}

0 commit comments

Comments
 (0)