Skip to content

Commit 356a5d3

Browse files
committed
fix: improve release workflow with proper permissions and modern actions
- Add proper permissions for GitHub token - Replace deprecated actions/create-release with ncipollo/release-action - Fix build step to use actual example applications - Add better release notes generation
1 parent 4db66c7 commit 356a5d3

1 file changed

Lines changed: 34 additions & 23 deletions

File tree

.github/workflows/release.yml

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

8+
permissions:
9+
contents: write
10+
issues: write
11+
pull-requests: write
12+
813
jobs:
914
release:
1015
name: Create Release
1116
runs-on: ubuntu-latest
17+
permissions:
18+
contents: write
19+
issues: write
20+
pull-requests: write
1221

1322
steps:
1423
- name: Check out code
@@ -29,17 +38,26 @@ jobs:
2938
with:
3039
version: v1.64.8
3140

32-
- name: Build binaries
41+
- name: Build example binaries
3342
run: |
3443
# Create dist directory
3544
mkdir -p dist
3645
37-
# Build for multiple platforms
38-
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/goflow-linux-amd64 ./cmd/...
39-
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o dist/goflow-darwin-amd64 ./cmd/...
40-
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o dist/goflow-darwin-arm64 ./cmd/...
41-
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/goflow-windows-amd64.exe ./cmd/...
42-
continue-on-error: true
46+
# Build example applications for multiple platforms
47+
echo "Building distributed-rate-limiting example..."
48+
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/distributed-rate-limiting-linux-amd64 ./examples/distributed-rate-limiting
49+
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o dist/distributed-rate-limiting-darwin-amd64 ./examples/distributed-rate-limiting
50+
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o dist/distributed-rate-limiting-darwin-arm64 ./examples/distributed-rate-limiting
51+
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/distributed-rate-limiting-windows-amd64.exe ./examples/distributed-rate-limiting
52+
53+
echo "Building web-service example..."
54+
GOOS=linux GOARCH=amd64 go build -ldflags="-s -w" -o dist/web-service-linux-amd64 ./examples/web-service
55+
GOOS=darwin GOARCH=amd64 go build -ldflags="-s -w" -o dist/web-service-darwin-amd64 ./examples/web-service
56+
GOOS=darwin GOARCH=arm64 go build -ldflags="-s -w" -o dist/web-service-darwin-arm64 ./examples/web-service
57+
GOOS=windows GOARCH=amd64 go build -ldflags="-s -w" -o dist/web-service-windows-amd64.exe ./examples/web-service
58+
59+
# List built files
60+
ls -la dist/
4361
4462
- name: Generate changelog
4563
id: changelog
@@ -53,12 +71,11 @@ jobs:
5371
fi
5472
5573
- name: Create Release
56-
uses: actions/create-release@v1
57-
env:
58-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
74+
uses: ncipollo/release-action@v1
5975
with:
60-
tag_name: ${{ github.ref }}
61-
release_name: Release ${{ github.ref }}
76+
token: ${{ secrets.GITHUB_TOKEN }}
77+
tag: ${{ github.ref_name }}
78+
name: "goflow ${{ github.ref_name }}"
6279
body: |
6380
## Changes
6481
${{ steps.changelog.outputs.CHANGELOG }}
@@ -68,16 +85,10 @@ jobs:
6885
go get github.com/vnykmshr/goflow@${{ github.ref_name }}
6986
```
7087
88+
## What's Changed
89+
See the [CHANGELOG.md](https://github.com/vnykmshr/goflow/blob/main/CHANGELOG.md) for detailed changes.
90+
91+
artifacts: "dist/*"
7192
draft: false
7293
prerelease: false
73-
74-
- name: Upload assets
75-
uses: actions/upload-release-asset@v1
76-
env:
77-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
78-
with:
79-
upload_url: ${{ steps.create_release.outputs.upload_url }}
80-
asset_path: ./dist/
81-
asset_name: goflow-binaries
82-
asset_content_type: application/zip
83-
continue-on-error: true
94+
generateReleaseNotes: true

0 commit comments

Comments
 (0)