-
Notifications
You must be signed in to change notification settings - Fork 10
122 lines (107 loc) · 3.64 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
name: Upload release artifacts
on:
release:
types: [created]
workflow_dispatch:
jobs:
binaries:
strategy:
matrix:
include:
- os: ubuntu-latest
rust_target: x86_64-unknown-linux-gnu
asset_name: leftwm-theme_x86_64_linux_gnu
runs-on: ${{ matrix.os }}
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo
~/.rustup
target/
key: ${{ runner.os }}-${{ steps.rust-install.outputs.cachekey }}-${{ matrix.rust_target }}-binary-release
- name: Install rust
id: rust-install
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.rust_target }}
- name: Set Cargo.toml version
if: github.event_name == 'release'
shell: bash
env:
RELEASE_TAG: ${{ github.ref }}
run: |
mv Cargo.toml Cargo.toml.origl2
sed "s/[0-9]*\\.[0-9]*\\.[0-9]*-git/${RELEASE_TAG##*\/v}/" Cargo.toml.origl2 > Cargo.toml
mv Cargo.lock Cargo.lock.origl2
sed "s/[0-9]*\\.[0-9]*\\.[0-9]*-git/${RELEASE_TAG##*\/v}/" Cargo.lock.origl2 > Cargo.lock
- name: Install cross-compile linker for aarch64-unknown-linux-musl
if: matrix.rust_target == 'aarch64-unknown-linux-musl'
run: |
sudo apt update
sudo apt install gcc-aarch64-linux-gnu
- name: Install openssl
run: |
sudo apt update
sudo apt install openssl pkg-config libssl-dev
cargo clean
OPENSSL_LIB_DIR="/usr/lib/x86_64-linux-gnu"
OPENSSL_INCLUDE_DIR="/usr/include/openssl"
- name: Build
env:
CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER: "/usr/bin/aarch64-linux-gnu-ld"
run: |
cargo +${{ steps.rust-install.outputs.name }} build --target ${{ matrix.rust_target }} --release --locked
- name: Upload
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref }}
file: target/${{ matrix.rust_target }}/release/leftwm-theme
asset_name: ${{ matrix.asset_name }}
crate:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
submodules: true
- name: Cache
uses: actions/cache@v3
with:
path: |
~/.cargo
~/.rustup
target/
key: ${{ runner.os }}-${{ steps.rust-install.outputs.cachekey }}-crate-release
- name: Install rust
id: rust-install
uses: dtolnay/rust-toolchain@stable
- name: Install openssl
run: |
sudo apt update
sudo apt install openssl pkg-config libssl-dev
cargo clean
OPENSSL_LIB_DIR="/usr/lib/x86_64-linux-gnu"
OPENSSL_INCLUDE_DIR="/usr/include/openssl"
- name: Set Cargo.toml version
if: github.event_name == 'release'
shell: bash
env:
RELEASE_TAG: ${{ github.ref }}
run: |
mv Cargo.toml Cargo.toml.origl2
sed "s/[0-9]*\\.[0-9]*\\.[0-9]*-git/${RELEASE_TAG##*\/v}/" Cargo.toml.origl2 > Cargo.toml
mv Cargo.lock Cargo.lock.origl2
sed "s/[0-9]*\\.[0-9]*\\.[0-9]*-git/${RELEASE_TAG##*\/v}/" Cargo.lock.origl2 > Cargo.lock
- name: Publish crate
if: github.event_name == 'release'
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: |
cargo publish --allow-dirty