-
Notifications
You must be signed in to change notification settings - Fork 0
137 lines (110 loc) · 3.84 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
name: Release
defaults:
run:
shell: bash
permissions:
contents: write
on:
push:
tags:
- "[0-9]+.[0-9]+.[0-9]+-*"
jobs:
build:
name: Build artifact
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- target: x86_64-unknown-linux-musl
os: ubuntu-latest
rust: stable
- target: aarch64-unknown-linux-musl
os: ubuntu-latest
rust: stable
- target: x86_64-apple-darwin
os: macos-latest
rust: stable
steps:
- uses: actions/checkout@v4
with:
sparse-checkout: cli-client
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: ${{ matrix.rust }}
- name: Get release version number
if: env.VERSION == ''
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Check that tag version and Cargo.toml version are the same
shell: bash
run: |
if ! grep -q "version = \"$VERSION\"" Cargo.toml; then
echo "version does not match Cargo.toml" >&2
exit 1
fi
- name: Install C compilation tooling (Linux)
if: matrix.os == 'ubuntu-latest'
run: |
sudo apt-get update -y
sudo apt-get install clang gcc-aarch64-linux-gnu musl-tools -y
- name: Add rustup target
run: rustup target add ${{ matrix.target }}
- uses: taiki-e/install-action@v2
with:
tool: cross
- name: Build release
run: cross build --release --target ${{ matrix.target }}
- name: Create release directory
run: mkdir -p artifacts/strikes-${{ env.VERSION }}-${{ matrix.target }}
- name: Move binary to release directory
run: mv target/${{ matrix.target }}/release/strikes artifacts/strikes-${{ env.VERSION }}-${{ matrix.target }}
- name: Create tarball
run: tar -czf ./artifacts/strikes-${{ env.VERSION }}-${{ matrix.target }}.tar.gz -C artifacts strikes-${{ env.VERSION }}-${{ matrix.target }}
- name: List files for debugging
run: ls -la
- name: List files in artifacts directory
run: ls -la ./artifacts
- name: Upload tarball
uses: actions/upload-artifact@v4
with:
name: strikes-${{ env.VERSION }}-${{ matrix.target }}
path: ./cli-client/artifacts/strikes-${{ env.VERSION }}-${{ matrix.target }}.tar.gz
release:
name: Release artifacts
runs-on: ubuntu-latest
needs: build
steps:
- uses: actions/checkout@v4
- name: Get release version number
if: env.VERSION == ''
run: echo "VERSION=${{ github.ref_name }}" >> $GITHUB_ENV
- name: Debug
uses: actions/download-artifact@v4
- name: List files
run: ls -R
- name: Download arm64 tarball
uses: actions/download-artifact@v4
with:
name: strikes-${{ env.VERSION }}-aarch64-unknown-linux-musl
- name: Download x86_64_apple_darwin tarball
uses: actions/download-artifact@v4
with:
name: strikes-${{ env.VERSION }}-x86_64-apple-darwin.tar.gz
- name: Download x86_64 tarball
uses: actions/download-artifact@v4
with:
name: strikes-${{ env.VERSION }}-x86_64-unknown-linux-musl
- name: Release arm64 tarball
uses: softprops/action-gh-release@v1
with:
files: |
strikes-${{ env.VERSION }}-aarch64-unknown-linux-musl
- name: Release x86_64_apple_darwin tarball
uses: softprops/action-gh-release@v1
with:
files: |
strikes-${{ env.VERSION }}-x86_64-apple-darwin
- name: Release x86_64 tarball
uses: softprops/action-gh-release@v1
with:
files: |
strikes-${{ env.VERSION }}-x86_64-unknown-linux-musl