Skip to content

Commit d2a74ba

Browse files
haasonsaasclaude
andcommitted
fix: update release workflow with proper permissions and modern actions
- Add write permissions for contents and packages - Switch to softprops/action-gh-release for better reliability - Add SHA256 checksums for all binaries - Fix Windows checksum generation - Remove Homebrew update for now (can add later) - Improve release notes with installation instructions 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 258a058 commit d2a74ba

File tree

1 file changed

+57
-48
lines changed

1 file changed

+57
-48
lines changed

.github/workflows/release.yml

Lines changed: 57 additions & 48 deletions
Original file line numberDiff line numberDiff line change
@@ -8,23 +8,55 @@ on:
88
env:
99
CARGO_TERM_COLOR: always
1010

11+
permissions:
12+
contents: write
13+
packages: write
14+
1115
jobs:
1216
create-release:
1317
name: Create Release
1418
runs-on: ubuntu-latest
15-
outputs:
16-
upload_url: ${{ steps.create_release.outputs.upload_url }}
19+
permissions:
20+
contents: write
1721
steps:
22+
- name: Checkout code
23+
uses: actions/checkout@v4
24+
25+
- name: Extract version
26+
id: get_version
27+
run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT
28+
1829
- name: Create Release
1930
id: create_release
20-
uses: actions/create-release@v1
21-
env:
22-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
31+
uses: softprops/action-gh-release@v1
2332
with:
2433
tag_name: ${{ github.ref }}
25-
release_name: Release ${{ github.ref }}
34+
name: Release ${{ steps.get_version.outputs.VERSION }}
35+
body: |
36+
# DiffScope ${{ steps.get_version.outputs.VERSION }}
37+
38+
See [CHANGELOG.md](https://github.com/haasonsaas/diffscope/blob/main/CHANGELOG.md) for details.
39+
40+
## 🚀 Installation
41+
42+
### Quick install (Linux/macOS):
43+
```bash
44+
curl -sSL https://raw.githubusercontent.com/haasonsaas/diffscope/main/install.sh | sh
45+
```
46+
47+
### Quick install (Windows):
48+
```powershell
49+
iwr -useb https://raw.githubusercontent.com/haasonsaas/diffscope/main/install.ps1 | iex
50+
```
51+
52+
### Manual installation:
53+
Download the appropriate binary below for your platform and add it to your PATH.
54+
55+
## 📦 Checksums
56+
SHA256 checksums will be available once all builds complete.
2657
draft: false
2758
prerelease: false
59+
generate_release_notes: true
2860

2961
build-release:
3062
name: Build Release
@@ -93,15 +125,25 @@ jobs:
93125
run: |
94126
strip target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
95127
128+
- name: Create checksum (Unix)
129+
if: matrix.os != 'windows-latest'
130+
run: |
131+
cd target/${{ matrix.target }}/release/
132+
sha256sum ${{ matrix.artifact_name }} > ${{ matrix.asset_name }}.sha256
133+
134+
- name: Create checksum (Windows)
135+
if: matrix.os == 'windows-latest'
136+
run: |
137+
cd target/${{ matrix.target }}/release/
138+
(Get-FileHash -Algorithm SHA256 ${{ matrix.artifact_name }}).Hash + " " + "${{ matrix.artifact_name }}" | Out-File -Encoding ASCII ${{ matrix.asset_name }}.sha256
139+
96140
- name: Upload Release Asset
97-
uses: actions/upload-release-asset@v1
98-
env:
99-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
141+
uses: softprops/action-gh-release@v1
100142
with:
101-
upload_url: ${{ needs.create-release.outputs.upload_url }}
102-
asset_path: target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
103-
asset_name: ${{ matrix.asset_name }}
104-
asset_content_type: application/octet-stream
143+
tag_name: ${{ github.ref }}
144+
files: |
145+
target/${{ matrix.target }}/release/${{ matrix.artifact_name }}
146+
target/${{ matrix.target }}/release/${{ matrix.asset_name }}.sha256
105147
106148
build-docker:
107149
name: Build and Push Docker Image
@@ -137,38 +179,5 @@ jobs:
137179
ghcr.io/haasonsaas/diffscope:latest
138180
ghcr.io/haasonsaas/diffscope:${{ steps.get_version.outputs.VERSION }}
139181
140-
update-homebrew:
141-
name: Update Homebrew Formula
142-
needs: build-release
143-
runs-on: ubuntu-latest
144-
steps:
145-
- name: Checkout tap repository
146-
uses: actions/checkout@v4
147-
with:
148-
repository: haasonsaas/homebrew-diffscope
149-
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
150-
151-
- name: Update formula
152-
run: |
153-
VERSION=${GITHUB_REF#refs/tags/v}
154-
sed -i "s/version \".*\"/version \"$VERSION\"/" Formula/diffscope.rb
155-
156-
# Calculate SHA256 for x86_64 macOS binary
157-
DARWIN_X64_URL="https://github.com/haasonsaas/diffscope/releases/download/v${VERSION}/diffscope-x86_64-apple-darwin"
158-
DARWIN_X64_SHA=$(curl -sL $DARWIN_X64_URL | shasum -a 256 | cut -d' ' -f1)
159-
160-
# Calculate SHA256 for ARM64 macOS binary
161-
DARWIN_ARM64_URL="https://github.com/haasonsaas/diffscope/releases/download/v${VERSION}/diffscope-aarch64-apple-darwin"
162-
DARWIN_ARM64_SHA=$(curl -sL $DARWIN_ARM64_URL | shasum -a 256 | cut -d' ' -f1)
163-
164-
# Update the formula with new checksums
165-
# This is a simplified example - you'd need to update the actual formula structure
166-
echo "Updated version to $VERSION"
167-
168-
- name: Commit and push changes
169-
run: |
170-
git config user.name github-actions
171-
git config user.email github-actions@github.com
172-
git add Formula/diffscope.rb
173-
git commit -m "Update diffscope to ${GITHUB_REF#refs/tags/}"
174-
git push
182+
# Homebrew formula update can be added later when tap repository is created
183+
# For now, users can use the install script or download binaries directly

0 commit comments

Comments
 (0)