-
Notifications
You must be signed in to change notification settings - Fork 3
149 lines (130 loc) · 4.41 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
name: Release Analytics CLI
on:
workflow_dispatch:
inputs:
release_tag:
type: string
description: Tag to create
required: True
concurrency: ${{ github.workflow }}
jobs:
build_linux:
name: Build ${{ matrix.target }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
artifact-name: x86_64-unknown-linux
runs-on: public-amd64-2xlarge
- target: aarch64-unknown-linux-musl
artifact-name: aarch64-unknown-linux
runs-on: public-arm64-2xlarge
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust & Cargo
uses: ./.github/actions/setup_rust_cargo
if: "!cancelled()"
- name: Update version
uses: ./.github/actions/update_version
if: "!cancelled()"
with:
version: ${{ github.event.inputs.release_tag }}
- name: Build ${{ matrix.target }} target
uses: ./.github/actions/build_cli_linux_target
if: "!cancelled()"
with:
target: ${{ matrix.target }}
profile: release-with-debug
- name: Upload debug info to Sentry
uses: ./.github/actions/upload_sentry_debug_info
if: "!cancelled()"
with:
target: ${{ matrix.target }}
sentry-org: ${{ secrets.SENTRY_ORG }}
sentry-project: ${{ secrets.SENTRY_PROJECT }}
sentry-auth-token: ${{ secrets.SENTRY_AUTH_TOKEN }}
- uses: actions/upload-artifact@v4
if: "!cancelled()"
with:
name: ${{ matrix.artifact-name }}
path: target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli
if-no-files-found: error
build_macos:
name: Build ${{ matrix.target }}
strategy:
matrix:
target: [x86_64-apple-darwin, aarch64-apple-darwin]
runs-on: [macos-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Setup Rust & Cargo
uses: ./.github/actions/setup_rust_cargo
if: "!cancelled()"
- name: Update version
uses: ./.github/actions/update_version
if: "!cancelled()"
with:
version: ${{ github.event.inputs.release_tag }}
- name: Build ${{ matrix.target }} target
uses: ./.github/actions/build_cli_macos_target
if: "!cancelled()"
with:
target: ${{ matrix.target }}
profile: release-with-debug
- name: Upload debug info to Sentry
uses: ./.github/actions/upload_sentry_debug_info
if: "!cancelled()"
with:
target: ${{ matrix.target }}
sentry-org: ${{ secrets.SENTRY_ORG }}
sentry-project: ${{ secrets.SENTRY_PROJECT }}
sentry-auth-token: ${{ secrets.SENTRY_AUTH_TOKEN }}
- uses: actions/upload-artifact@v4
if: "!cancelled()"
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli
if-no-files-found: error
tag_and_release:
name: Tag and Release [ ${{ github.event.inputs.release_tag }} ]
runs-on: public-amd64-small
needs: [build_linux, build_macos]
steps:
- uses: actions/checkout@v4
- id: download
uses: actions/download-artifact@v4
with:
path: build
- name: Compress binaries
run: |
for target in $(ls build)
do
chmod u+x build/${target}/trunk-analytics-cli
tar czvf \
build/trunk-analytics-cli-${target}.tar.gz \
-C build/${target} trunk-analytics-cli
done
- name: Install gh
uses: trunk-io/trunk-action/install@v1
with:
tools: gh
- name: Create GH release and upload binary
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh release create --prerelease --latest=false \
--target ${{ github.ref }} \
--generate-notes ${{ github.event.inputs.release_tag }} \
./build/*.tar.gz
- name: Create Sentry release
uses: getsentry/action-release@v1
env:
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }}
SENTRY_ORG: ${{ secrets.SENTRY_ORG }}
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }}
with:
environment: production
version: ${{ github.event.inputs.release_tag }}