Skip to content

Commit 71d568a

Browse files
committed
fix: Fix release workflow permissions and use gh CLI
- Add explicit write permissions for contents and packages - Replace deprecated actions/create-release with gh CLI - Replace deprecated upload-release-asset with gh CLI - Fix release notes formatting
1 parent f1f92ea commit 71d568a

File tree

1 file changed

+33
-50
lines changed

1 file changed

+33
-50
lines changed

.github/workflows/release.yml

Lines changed: 33 additions & 50 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,10 @@ on:
55
tags:
66
- 'v*'
77

8+
permissions:
9+
contents: write
10+
packages: write
11+
812
env:
913
CARGO_TERM_COLOR: always
1014

@@ -33,41 +37,30 @@ jobs:
3337

3438
- name: Create Release
3539
id: create_release
36-
uses: actions/create-release@v1
3740
env:
3841
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
39-
with:
40-
tag_name: ${{ github.ref }}
41-
release_name: Release ${{ github.ref }}
42-
body: |
43-
## What's Changed
44-
${{ steps.changelog.outputs.changelog }}
45-
46-
## Installation
47-
48-
### macOS/Linux
49-
```bash
50-
curl -fsSL https://get.kanuni.dev | sh
51-
```
52-
53-
### Homebrew
54-
```bash
55-
brew install v-lawyer/tap/kanuni
56-
```
57-
58-
### npm
59-
```bash
60-
npm install -g kanuni-cli
61-
```
62-
63-
### Cargo
64-
```bash
65-
cargo install kanuni
66-
```
67-
68-
See full installation instructions in the [documentation](https://docs.v-lawyer.ai/docs/cli/installation).
69-
draft: false
70-
prerelease: false
42+
run: |
43+
gh release create "${{ github.ref }}" \
44+
--title "Release v${{ steps.get_version.outputs.version }}" \
45+
--notes "## Installation
46+
47+
### Install via npm
48+
\`\`\`bash
49+
npm install -g @v-lawyer/kanuni
50+
\`\`\`
51+
52+
### Install via Cargo
53+
\`\`\`bash
54+
cargo install kanuni
55+
\`\`\`
56+
57+
### Download binaries
58+
See Assets below for platform-specific binaries.
59+
60+
## What's New
61+
See [CHANGELOG.md](https://github.com/v-lawyer/kanuni-cli/blob/main/CHANGELOG.md) for details."
62+
63+
echo "upload_url=$(gh release view "${{ github.ref }}" --json uploadUrl -q .uploadUrl)" >> $GITHUB_OUTPUT
7164
7265
build-release:
7366
name: Build Release
@@ -144,25 +137,15 @@ jobs:
144137
shasum -a 256 ${{ matrix.name }}.tar.gz > ${{ matrix.name }}.tar.gz.sha256
145138
fi
146139
147-
- name: Upload Release Asset (Archive)
148-
uses: actions/upload-release-asset@v1
140+
- name: Upload Release Assets
149141
env:
150142
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
151-
with:
152-
upload_url: ${{ needs.create-release.outputs.upload_url }}
153-
asset_path: ${{ matrix.os == 'windows-latest' && format('{0}.zip', matrix.name) || format('{0}.tar.gz', matrix.name) }}
154-
asset_name: ${{ matrix.os == 'windows-latest' && format('{0}.zip', matrix.name) || format('{0}.tar.gz', matrix.name) }}
155-
asset_content_type: ${{ matrix.os == 'windows-latest' && 'application/zip' || 'application/gzip' }}
156-
157-
- name: Upload Release Asset (Checksum)
158-
uses: actions/upload-release-asset@v1
159-
env:
160-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
161-
with:
162-
upload_url: ${{ needs.create-release.outputs.upload_url }}
163-
asset_path: ${{ matrix.os == 'windows-latest' && format('{0}.zip.sha256', matrix.name) || format('{0}.tar.gz.sha256', matrix.name) }}
164-
asset_name: ${{ matrix.os == 'windows-latest' && format('{0}.zip.sha256', matrix.name) || format('{0}.tar.gz.sha256', matrix.name) }}
165-
asset_content_type: text/plain
143+
run: |
144+
if [[ "${{ matrix.os }}" == "windows-latest" ]]; then
145+
gh release upload "${{ github.ref }}" "${{ matrix.name }}.zip" "${{ matrix.name }}.zip.sha256"
146+
else
147+
gh release upload "${{ github.ref }}" "${{ matrix.name }}.tar.gz" "${{ matrix.name }}.tar.gz.sha256"
148+
fi
166149
167150
publish-crate:
168151
name: Publish to crates.io

0 commit comments

Comments
 (0)