-
Notifications
You must be signed in to change notification settings - Fork 0
169 lines (151 loc) · 6.04 KB
/
release.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
name: Release
on:
push:
tags:
- 'v*'
jobs:
release:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Set up Go
uses: actions/setup-go@v3
with:
go-version: 1.18
- name: Set up Environment Variables
run: echo "VERSION=$(git describe --tags --always)" >> $GITHUB_ENV
- name: Build for Linux amd64
env:
GOOS: linux
GOARCH: amd64
VERSION: ${{ env.VERSION }}
run: |
mkdir -p build
OUTPUT="build/bruno-init-suite-${GOOS}-${GOARCH}"
env GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X bruno-init-suite/internal/version.Version=${VERSION}" -o "${OUTPUT}"
tar -czvf "${OUTPUT}.tar.gz" -C build "bruno-init-suite-${GOOS}-${GOARCH}"
- name: Build for Linux arm64
env:
GOOS: linux
GOARCH: arm64
VERSION: ${{ env.VERSION }}
run: |
OUTPUT="build/bruno-init-suite-${GOOS}-${GOARCH}"
env GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X bruno-init-suite/internal/version.Version=${VERSION}" -o "${OUTPUT}"
tar -czvf "${OUTPUT}.tar.gz" -C build "bruno-init-suite-${GOOS}-${GOARCH}"
- name: Build for macOS amd64
env:
GOOS: darwin
GOARCH: amd64
VERSION: ${{ env.VERSION }}
run: |
OUTPUT="build/bruno-init-suite-${GOOS}-${GOARCH}"
env GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X bruno-init-suite/internal/version.Version=${VERSION}" -o "${OUTPUT}"
tar -czvf "${OUTPUT}.tar.gz" -C build "bruno-init-suite-${GOOS}-${GOARCH}"
- name: Build for macOS arm64
env:
GOOS: darwin
GOARCH: arm64
VERSION: ${{ env.VERSION }}
run: |
OUTPUT="build/bruno-init-suite-${GOOS}-${GOARCH}"
env GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X bruno-init-suite/internal/version.Version=${VERSION}" -o "${OUTPUT}"
tar -czvf "${OUTPUT}.tar.gz" -C build "bruno-init-suite-${GOOS}-${GOARCH}"
- name: Build for Windows amd64
env:
GOOS: windows
GOARCH: amd64
VERSION: ${{ env.VERSION }}
run: |
OUTPUT="build/bruno-init-suite-${GOOS}-${GOARCH}.exe"
env GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X bruno-init-suite/internal/version.Version=${VERSION}" -o "${OUTPUT}"
zip "${OUTPUT}.zip" -j "${OUTPUT}"
- name: Build for Windows 386
env:
GOOS: windows
GOARCH: 386
VERSION: ${{ env.VERSION }}
run: |
OUTPUT="build/bruno-init-suite-${GOOS}-${GOARCH}.exe"
env GOOS=${GOOS} GOARCH=${GOARCH} go build -ldflags "-X bruno-init-suite/internal/version.Version=${VERSION}" -o "${OUTPUT}"
zip "${OUTPUT}.zip" -j "${OUTPUT}"
- name: Check if Release Exists
id: check_release
run: |
if gh release view ${{ github.ref }}; then
echo "release_exists=true" >> $GITHUB_ENV
else
echo "release_exists=false" >> $GITHUB_ENV
fi
- name: Create Release
id: create_release
if: env.release_exists == 'false'
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: false
body: |
# Release Notes
- Features and improvements:
- Added support for macOS arm64
- Improved performance on Linux
- Bug fixes for Windows builds
- name: Upload Linux amd64 Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/bruno-init-suite-linux-amd64.tar.gz
asset_name: bruno-init-suite-linux-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload Linux arm64 Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/bruno-init-suite-linux-arm64.tar.gz
asset_name: bruno-init-suite-linux-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload macOS amd64 Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/bruno-init-suite-darwin-amd64.tar.gz
asset_name: bruno-init-suite-darwin-amd64.tar.gz
asset_content_type: application/gzip
- name: Upload macOS arm64 Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/bruno-init-suite-darwin-arm64.tar.gz
asset_name: bruno-init-suite-darwin-arm64.tar.gz
asset_content_type: application/gzip
- name: Upload Windows amd64 Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/bruno-init-suite-windows-amd64.exe.zip
asset_name: bruno-init-suite-windows-amd64.exe.zip
asset_content_type: application/zip
- name: Upload Windows 386 Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.PAT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: build/bruno-init-suite-windows-386.exe.zip
asset_name: bruno-init-suite-windows-386.exe.zip
asset_content_type: application/zip