-
Notifications
You must be signed in to change notification settings - Fork 3
141 lines (118 loc) · 4.56 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
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-small
- target: aarch64-unknown-linux-musl
artifact-name: aarch64-unknown-linux
runs-on: public-arm64-medium
runs-on: ${{ matrix.runs-on }}
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
- name: Update version
run: |
export VERSION=${{ github.event.inputs.release_tag }}
sed -i "s/0.0.0/$VERSION/g" ./cli/Cargo.toml
- name: Build ${{ matrix.target }} target
uses: ./.github/actions/build_target
if: "!cancelled()"
with:
target: ${{ matrix.target }}
profile: release-with-debug
- name: Install sentry-cli
run: curl -sL https://sentry.io/get-cli/ | sh
- name: Upload debug info to Sentry
run: sentry-cli debug-files upload --include-sources target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli.debug --org=${{ secrets.SENTRY_ORG }} --project=${{ secrets.SENTRY_PROJECT }} --auth-token=${{ secrets.SENTRY_AUTH_TOKEN }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact-name }}
path: target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli
if-no-files-found: error
build_osx:
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: Install Rust toolchain
uses: dtolnay/rust-toolchain@nightly
with:
targets: ${{ matrix.target }}
- name: Update version
run: |
export VERSION=${{ github.event.inputs.release_tag }}
sed -i '' "s/0.0.0/$VERSION/g" ./cli/Cargo.toml
- name: Add target
shell: bash
run: rustup target add ${{ matrix.target }}
- name: Build ${{ matrix.target }} target
if: "!cancelled()"
run: cargo build -q --all --profile=release-with-debug --target ${{ matrix.target }}
- name: Strip debug info
run: strip target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli
if-no-files-found: error
- name: Install sentry-cli
run: curl -sL https://sentry.io/get-cli/ | sh
- name: Upload debug info to Sentry
run: sentry-cli debug-files upload --include-sources target/${{ matrix.target }}/release-with-debug/trunk-analytics-cli.dSYM --org=${{ secrets.SENTRY_ORG }} --project=${{ secrets.SENTRY_PROJECT }} --auth-token=${{ secrets.SENTRY_AUTH_TOKEN }}
tag_and_release:
name: Tag and Release [ ${{ github.event.inputs.release_tag }} ]
runs-on: public-amd64-small
needs: [build_linux, build_osx]
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 Trunk
uses: trunk-io/trunk-action/install@54ccfcf9add644a36a5aa1d0046c92f654ff9e45
- 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 }}