-
-
Notifications
You must be signed in to change notification settings - Fork 10
79 lines (67 loc) · 2.28 KB
/
release.yaml
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
name: Semantic release
on:
push:
branches:
- main
- beta
workflow_dispatch:
jobs:
release:
name: Semantic release
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Generate token
id: generate_token
uses: tibdex/github-app-token@v1
with:
app_id: ${{ secrets.OS_GITHUB_APP_ID }}
private_key: ${{ secrets.OS_GITHUB_APP_PRIVATE_KEY }}
- name: "☁️ checkout repository"
uses: actions/checkout@v3
with:
fetch-depth: 0
token: ${{ steps.generate_token.outputs.token }}
- name: "🔧 setup node"
uses: actions/setup-node@v3
with:
node-version: 18
- name: "🔧 install npm@latest"
run: npm i -g npm@latest
- name: "🚀 release"
id: semantic-release
env:
GITHUB_TOKEN: ${{ steps.generate_token.outputs.token }}
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_PACKAGE_ROOT: "npm"
uses: open-sauced/[email protected]
outputs:
release-tag: ${{ steps.semantic-release.outputs.release-tag }}
build:
needs:
- release
runs-on: ubuntu-latest
permissions:
contents: write # release changes require contents write
strategy:
matrix:
goos: [darwin, linux, windows]
goarch: [amd64, arm64]
steps:
- name: Set up Go
uses: actions/setup-go@fac708d6674e30b6ba41289acaab6d4b75aa0753 # v4.0.1
with:
go-version: 1.21
- name: Check out code
uses: actions/checkout@v3
- name: Build and upload Go binaries
env:
GH_TOKEN: ${{ github.token }}
run: |
GOOS=${{ matrix.goos }} GOARCH=${{ matrix.goarch }} go build \
-ldflags="-s -w" \
-ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.writeOnlyPublicPosthogKey=${{ secrets.POSTHOG_WRITE_PUBLIC_KEY }}'" \
-ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Version={{ needs.release.outputs.release-tag }}'" \
-ldflags="-X 'github.com/open-sauced/pizza-cli/pkg/utils.Sha=$(git rev-parse HEAD)'" \
-o build/pizza-${{ matrix.goos }}-${{ matrix.goarch }}
gh release upload ${{ needs.release.outputs.release-tag }} build/pizza-${{ matrix.goos }}-${{ matrix.goarch }}