Skip to content
This repository was archived by the owner on Oct 21, 2023. It is now read-only.

Commit 86a2589

Browse files
author
Itsusinn
committed
ci: improve release workflow
1 parent d0be64f commit 86a2589

File tree

2 files changed

+108
-56
lines changed

2 files changed

+108
-56
lines changed

.github/compress.sh

+11
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
apt-get install zip
2+
cd packages
3+
for files in $(ls)
4+
do
5+
zip $files.zip $files
6+
rm $files
7+
done
8+
for files in $(ls *.exe.zip)
9+
do
10+
mv $files ${files%%.*}.zip
11+
done

.github/workflows/release.yml

+97-56
Original file line numberDiff line numberDiff line change
@@ -3,79 +3,120 @@ on:
33
push:
44
tags:
55
- "v*"
6+
env:
7+
SHORT_NAME: walle-q
8+
CRATE_NAME: walle-q
69

710
jobs:
8-
release-win:
9-
runs-on: windows-latest
11+
compile:
12+
name: Compile
13+
runs-on: ${{ matrix.os }}
1014
strategy:
1115
matrix:
1216
include:
13-
- target: i686-pc-windows-msvc
14-
name: walle-q-win-i686.exe
15-
- target: x86_64-pc-windows-msvc
16-
name: walle-q-win-x86_64.exe
17+
# Linux
18+
- os: ubuntu-latest
19+
target: x86_64-unknown-linux-musl
20+
release_name: x86_64-linux-musl
21+
postfix: ""
22+
extra_args: ""
23+
cross: true
24+
25+
- os: ubuntu-latest
26+
target: i686-unknown-linux-musl
27+
release_name: i686-linux-musl
28+
postfix: ""
29+
extra_args: ""
30+
cross: true
31+
32+
- os: ubuntu-latest
33+
target: aarch64-unknown-linux-gnu
34+
release_name: aarch64-linux-gnu
35+
postfix: ""
36+
extra_args: ""
37+
cross: true
38+
# Windows GNU
39+
- os: ubuntu-latest
40+
target: x86_64-pc-windows-gnu
41+
release_name: x86_64-windows-gnu.exe
42+
postfix: ".exe"
43+
extra_args: ""
44+
cross: true
45+
46+
- os: ubuntu-latest
47+
target: i686-pc-windows-gnu
48+
release_name: i686-windows-gnu.exe
49+
postfix: ".exe"
50+
extra_args: ""
51+
cross: true
52+
53+
# Mac OSX
54+
- os: macos-latest
55+
target: x86_64-apple-darwin
56+
release_name: x86_64-mac
57+
postfix: ""
58+
extra_args: ""
59+
cross: false
1760

1861
steps:
19-
- name: checkout
20-
uses: actions/checkout@v2
62+
- uses: actions/checkout@v2
63+
with:
64+
submodules: recursive
65+
66+
- name: Resume cache
67+
uses: actions/cache@v2
2168
with:
22-
fetch-depth: 0
23-
- name: rust-toolchain
24-
uses: actions-rs/toolchain@v1
69+
path: |
70+
~/.cargo/registry
71+
~/.cargo/git
72+
key: ${{ matrix.target }}-release-${{ hashFiles('**/Cargo.toml') }}
73+
restore-keys: |
74+
${{ matrix.target }}-release
75+
76+
- uses: actions-rs/toolchain@v1
2577
with:
2678
toolchain: nightly
27-
override: true
2879
target: ${{ matrix.target }}
29-
- name: set-up-clang
30-
uses: egor-tensin/setup-clang@v1
31-
- name: cargo-build
32-
uses: actions-rs/cargo@v1
80+
override: true
81+
82+
- uses: actions-rs/cargo@v1
3383
with:
84+
use-cross: ${{ matrix.cross }}
3485
command: build
35-
args: --release --target ${{ matrix.target }}
36-
- name: upload-release
37-
uses: svenstaro/upload-release-action@v2
86+
args: --release --target ${{ matrix.target }} ${{ matrix.extra_args }}
87+
88+
- name: Rename binary
89+
run: mv target/${{ matrix.target }}/release/${{ env.CRATE_NAME }}${{ matrix.postfix }} ${{ env.SHORT_NAME }}-${{ matrix.release_name }}
90+
91+
- name: Upload binaries
92+
uses: actions/upload-artifact@v2
3893
with:
39-
repo_token: ${{ secrets.GITHUB_TOKEN }}
40-
file: target/${{ matrix.target }}/release/walle-q.exe
41-
asset_name: ${{ matrix.name }}
42-
tag: ${{ github.ref }}
94+
name: compile
95+
path: ${{ env.SHORT_NAME }}-${{ matrix.release_name }}
4396

44-
release-linux:
97+
release:
98+
name: Release
99+
needs: [compile]
45100
runs-on: ubuntu-latest
46-
strategy:
47-
matrix:
48-
include:
49-
- target: i686-unknown-linux-gnu
50-
name: walle-q-linux-i686
51-
- target: x86_64-unknown-linux-gnu
52-
name: walle-q-linux-x86_64
53-
54101
steps:
55-
- name: checkout
56-
uses: actions/checkout@v2
57-
with:
58-
fetch-depth: 0
59-
- name: multilib
60-
if: ${{ matrix.target == 'i686-unknown-linux-gnu' }}
61-
run: sudo apt-get install -y gcc-multilib
62-
- name: rust-toolchain
63-
uses: actions-rs/toolchain@v1
102+
- uses: actions/checkout@v2
64103
with:
65-
toolchain: nightly
66-
override: true
67-
target: ${{ matrix.target }}
68-
- name: set-up-clang
69-
uses: egor-tensin/setup-clang@v1
70-
- name: cargo-build
71-
uses: actions-rs/cargo@v1
104+
submodules: recursive
105+
106+
- name: Download binaries
107+
uses: actions/download-artifact@v2
72108
with:
73-
command: build
74-
args: --release --target ${{ matrix.target }}
75-
- name: upload-release
76-
uses: svenstaro/upload-release-action@v2
109+
name: compile
110+
path: ./packages
111+
112+
- name: Compress
113+
run: bash ./.github/compress.sh
114+
115+
- name: Github release
116+
uses: "marvinpinto/action-automatic-releases@latest"
77117
with:
78-
repo_token: ${{ secrets.GITHUB_TOKEN }}
79-
file: target/${{ matrix.target }}/release/walle-q
80-
asset_name: ${{ matrix.name }}
81-
tag: ${{ github.ref }}
118+
repo_token: "${{ secrets.GITHUB_TOKEN }}"
119+
prerelease: false
120+
files: |
121+
packages/*
122+
LICENSE

0 commit comments

Comments
 (0)