Skip to content

Commit 70e83b5

Browse files
authored
Merge pull request #22 from fern-api/devin/1773855900-add-release-workflow
2 parents 8a07810 + 7978bec commit 70e83b5

1 file changed

Lines changed: 54 additions & 0 deletions

File tree

.github/workflows/release.yml

Lines changed: 54 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,54 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
8+
permissions:
9+
contents: write
10+
11+
jobs:
12+
release:
13+
name: Build and Release
14+
runs-on: ubuntu-latest
15+
steps:
16+
- name: Check out code
17+
uses: actions/checkout@v4
18+
19+
- name: Set up Go
20+
uses: actions/setup-go@v5
21+
with:
22+
go-version: "^1.20"
23+
24+
- name: Build binaries
25+
run: |
26+
VERSION=${GITHUB_REF_NAME}
27+
BINARY=protoc-gen-openapi
28+
MODULE=./cmd/protoc-gen-openapi
29+
30+
platforms=(
31+
"linux/amd64"
32+
"linux/arm64"
33+
"darwin/amd64"
34+
"darwin/arm64"
35+
"windows/amd64"
36+
"windows/arm64"
37+
)
38+
39+
for platform in "${platforms[@]}"; do
40+
GOOS="${platform%/*}"
41+
GOARCH="${platform#*/}"
42+
output="${BINARY}-${GOOS}-${GOARCH}"
43+
if [ "$GOOS" = "windows" ]; then
44+
output="${output}.exe"
45+
fi
46+
echo "Building ${output}..."
47+
GOOS=$GOOS GOARCH=$GOARCH go build -trimpath -ldflags="-s -w" -o "dist/${output}" $MODULE
48+
done
49+
50+
- name: Create Release
51+
uses: softprops/action-gh-release@v2
52+
with:
53+
generate_release_notes: true
54+
files: dist/*

0 commit comments

Comments
 (0)