-
-
Notifications
You must be signed in to change notification settings - Fork 23
184 lines (168 loc) · 5.91 KB
/
cd.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
name: Continuous Deployment
on:
push:
tags:
- "v*.*.*"
jobs:
publish-github:
name: Publish on GitHub
runs-on: ubuntu-22.04
strategy:
fail-fast: false
matrix:
TOOLCHAIN: [nightly]
CONFIG:
- { TARGET: x86_64-unknown-linux-gnu, FEATURES: "" }
- { TARGET: x86_64-unknown-linux-musl, FEATURES: "" }
- {
TARGET: x86_64-unknown-linux-gnu,
FEATURES: "--no-default-features",
}
- {
TARGET: x86_64-unknown-linux-musl,
FEATURES: "--no-default-features",
}
- {
TARGET: i686-unknown-linux-gnu,
FEATURES: "--no-default-features",
}
- {
TARGET: i686-unknown-linux-musl,
FEATURES: "--no-default-features",
}
- {
TARGET: aarch64-unknown-linux-gnu,
FEATURES: "--no-default-features",
}
- {
TARGET: aarch64-unknown-linux-musl,
FEATURES: "--no-default-features",
}
- {
TARGET: armv5te-unknown-linux-gnueabi,
FEATURES: "--no-default-features",
}
- {
TARGET: armv7-unknown-linux-gnueabihf,
FEATURES: "--no-default-features",
}
- {
TARGET: arm-unknown-linux-gnueabi,
FEATURES: "--no-default-features",
}
- {
TARGET: arm-unknown-linux-gnueabihf,
FEATURES: "--no-default-features",
}
- {
TARGET: riscv64gc-unknown-linux-gnu,
FEATURES: "--no-default-features",
}
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
--allow-unauthenticated \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev \
musl-tools
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set the release version
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Install Rust
uses: actions-rs/toolchain@v1
with:
toolchain: ${{ matrix.TOOLCHAIN }}
target: ${{ matrix.CONFIG.TARGET }}
profile: minimal
override: true
- name: Build
uses: actions-rs/cargo@v1
with:
use-cross: ${{ matrix.CONFIG.FEATURES != '' }}
command: build
args: >
--release --locked --target ${{ matrix.CONFIG.TARGET }} ${{ matrix.CONFIG.FEATURES }}
- name: Prepare release assets
id: assets
shell: bash
run: |
release_dir="systeroid-${{ env.RELEASE_VERSION }}"
if [ -z "${{ matrix.CONFIG.FEATURES }}" ]; then
artifact_name="$release_dir-${{ matrix.CONFIG.TARGET }}_all-features.tar.gz"
else
artifact_name="$release_dir-${{ matrix.CONFIG.TARGET }}.tar.gz"
fi
mkdir -p release/man8
cp {README.md,LICENSE-*,CHANGELOG.md} release/
cp man8/* release/man8/
for bin in 'systeroid' 'systeroid-tui'; do
cp "target/${{ matrix.CONFIG.TARGET }}/release/$bin" release/
done
mv release/ "$release_dir/"
tar -czvf "$artifact_name" "$release_dir/"
echo "artifact_name=$artifact_name" >> $GITHUB_OUTPUT
- name: Sign assets & generate checksums
run: |
sha512sum ${{ steps.assets.outputs.artifact_name }} > \
${{ steps.assets.outputs.artifact_name }}.sha512
echo "${{ secrets.GPG_KEY }}" | base64 --decode > signing.key
echo "${{ secrets.GPG_PASSPHRASE }}" | \
gpg --pinentry-mode=loopback --passphrase-fd 0 --import signing.key
echo "${{ secrets.GPG_PASSPHRASE }}" | \
gpg --pinentry-mode=loopback --passphrase-fd 0 --detach-sign \
${{ steps.assets.outputs.artifact_name }}
- name: Upload the release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ steps.assets.outputs.artifact_name }}*
file_glob: true
overwrite: true
tag: ${{ github.ref }}
body: |
See [**CHANGELOG.md**](https://github.com/orhun/systeroid/blob/main/CHANGELOG.md) for release notes.
publish-crates-io:
name: Publish on crates.io
needs: publish-github
runs-on: ubuntu-22.04
steps:
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y \
--no-install-recommends \
--allow-unauthenticated \
libxcb-shape0-dev \
libxcb-xfixes0-dev \
libxkbcommon-dev
- name: Checkout the repository
uses: actions/checkout@v4
- name: Set the release version
run: echo "RELEASE_VERSION=${GITHUB_REF:11}" >> $GITHUB_ENV
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: Publish the core library
run: |
cargo publish \
--manifest-path systeroid-core/Cargo.toml \
--locked \
--token ${{ secrets.CARGO_TOKEN }}
- name: Wait for core library to be discoverable
shell: bash
run: |
crate_status="https://raw.githubusercontent.com/rust-lang/crates.io-index/master/sy/st/systeroid-core"
until curl -s "$crate_status" | grep -q '"vers":"${{ env.RELEASE_VERSION }}"'; do sleep 5; done;
- name: Publish the binaries
shell: bash
run: |
for bin in 'systeroid' 'systeroid-tui'; do
cargo publish \
--manifest-path "$bin/Cargo.toml" \
--locked \
--token ${{ secrets.CARGO_TOKEN }}
done