This repository has been archived by the owner on May 11, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 22
211 lines (201 loc) · 7.76 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
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
name: Release
on:
push:
tags:
- test
- "v[0-9]+.[0-9]+.[0-9]+"
jobs:
cargo-package-version-matches-git-tag-version:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- uses: actions-rs/toolchain@v1
with:
profile: minimal
- run: sudo apt-get update
- run: sudo apt-get install -y jq
- shell: bash
id: git-tag
run: echo ::set-output name=GIT_TAG::${GITHUB_REF/refs\/tags\//}
- shell: bash
id: cargo-package-version
run: echo ::set-output name=CARGO_PACKAGE_VERSION::$(cargo metadata --format-version=1 | jq -r '.packages | .[] | select(.name=="radicle-cli") | .version')
- shell: bash
run: test "${{ steps.git-tag.outputs.GIT_TAG }}" = v"${{ steps.cargo-package-version.outputs.CARGO_PACKAGE_VERSION }}"
release-linux-binaries:
needs: cargo-package-version-matches-git-tag-version
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Configure build cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
!target/debian
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build the binaries
uses: addnab/docker-run-action@v3
with:
image: registry.gitlab.com/rust_musl_docker/image:stable-latest
options: -v ${{ github.workspace }}:/workdir -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry
run: |
rustup target add x86_64-unknown-linux-musl
cargo build --release -v --target=x86_64-unknown-linux-musl
- name: Build deb package
uses: addnab/docker-run-action@v3
with:
image: registry.gitlab.com/rust_musl_docker/image:stable-latest
options: -v ${{ github.workspace }}:/workdir -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry
run: |
apt update
apt install --yes asciidoctor
.github/build-man-page.bash $(find . -name '*.adoc')
cargo install cargo-deb
cargo deb --target x86_64-unknown-linux-musl --no-build --package radicle-cli
- shell: bash
run: |
staging="radicle-cli-x86_64-unknown-linux-musl"
mkdir -p "$staging"
find target/x86_64-unknown-linux-musl/release -maxdepth 1 -name 'rad*' -executable | xargs --replace cp '{}' "$staging"/
cp target/x86_64-unknown-linux-musl/release/git-remote-rad "$staging"/
cp *.1.gz "$staging"/
tar czf "$staging.tar.gz" "$staging"
- uses: actions/upload-artifact@v2
with:
name: deb-package
path: target/x86_64-unknown-linux-musl/debian/*.deb
- uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
radicle-cli-x86_64-unknown-linux-musl.tar.gz
target/x86_64-unknown-linux-musl/debian/*.deb
release-arm-linux-binaries:
runs-on: ubuntu-20.04
steps:
- name: Checkout source code
uses: actions/checkout@v2
- name: Configure build cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
!target/debian
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: Build the binaries
uses: addnab/docker-run-action@v3
with:
image: messense/rust-musl-cross:aarch64-musl
options: -v ${{ github.workspace }}:/home/rust/src -v /home/runner/.cargo/git:/root/.cargo/git -v /home/runner/.cargo/registry:/root/.cargo/registry
run: |
rustup target add aarch64-unknown-linux-musl
cargo build --release
apt update
apt install --yes asciidoctor
.github/build-man-page.bash $(find . -name '*.adoc')
- shell: bash
run: |
staging="radicle-cli-aarch64-unknown-linux-musl"
mkdir -p "$staging"
find target/aarch64-unknown-linux-musl/release -maxdepth 1 -name 'rad*' -executable | xargs --replace cp '{}' "$staging"/
cp target/aarch64-unknown-linux-musl/release/git-remote-rad "$staging"/
cp *.1.gz "$staging"/
tar czf "$staging.tar.gz" "$staging"
- uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
radicle-cli-aarch64-unknown-linux-musl.tar.gz
upload-deb:
needs: release-linux-binaries
runs-on: ubuntu-20.04
permissions:
contents: 'read'
id-token: 'write'
steps:
- uses: actions/download-artifact@v2
with:
name: deb-package
- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
workload_identity_provider: 'projects/281042598092/locations/global/workloadIdentityPools/github-actions/providers/google-cloud'
service_account: '[email protected]'
- name: 'Set up Cloud SDK'
uses: 'google-github-actions/setup-gcloud@v0'
with:
install_components: beta
- name: Upload .deb package to an APT repo
run: gcloud --quiet beta artifacts apt upload radicle-cli --location=europe-west6 --source *.deb
release-macos-binaries:
needs: cargo-package-version-matches-git-tag-version
runs-on: macos-11
strategy:
matrix:
target:
- x86_64-apple-darwin
- aarch64-apple-darwin
steps:
- run: brew install asciidoctor
- uses: actions/checkout@v2
- name: Configure build cache
uses: actions/cache@v2
with:
path: |
~/.cargo/registry
~/.cargo/git
target
!target/debian
key: cargo-${{ runner.os }}-${{ hashFiles('**/Cargo.lock') }}
- name: script
run: .github/build-man-page.bash $(find . -name '*.adoc')
shell: bash
- uses: actions-rs/toolchain@v1
with:
profile: minimal
target: ${{ matrix.target }}
- name: Build the release binaries
run: env OPENSSL_STATIC=1 OPENSSL_DIR=/usr/local/opt/[email protected] LIBUSB_STATIC=1 cargo build --release --target ${{ matrix.target }}
- name: Build the release archive
shell: bash
run: |
staging="radicle-cli-${{ matrix.target }}"
mkdir -p "$staging"
find ./target/${{ matrix.target }}/release -maxdepth 1 -name 'rad*' -perm +111 -type f | xargs -J '{}' -n 1 cp '{}' "$staging"/
cp ./target/${{ matrix.target }}/release/git-remote-rad "$staging"/
cp *.1.gz "$staging"/
tar czf "$staging.tar.gz" "$staging"
- uses: softprops/action-gh-release@v1
with:
fail_on_unmatched_files: true
files: |
radicle-cli-*.tar.gz
smoke-test-deb:
needs: upload-deb
strategy:
matrix:
build:
- ubuntu-18.04
- ubuntu-20.04
include:
- build: ubuntu-18.04
os: ubuntu-18.04
rust: stable
target: i686-ubuntu-linux-gnu
- build: ubuntu-20.04
os: ubuntu-20.04
rust: stable
target: i686-ubuntu-linux-gnu
runs-on: ${{ matrix.os }}
steps:
- run: curl https://europe-west6-apt.pkg.dev/doc/repo-signing-key.gpg | sudo apt-key add -
- run: echo deb https://europe-west6-apt.pkg.dev/projects/radicle-services radicle-cli main | sudo tee -a /etc/apt/sources.list.d/radicle-registry.list
- run: sudo apt-get update
- run: sudo apt-get install radicle-cli
- run: rad help