Skip to content

Commit eb91ee5

Browse files
committed
ci: static build using musl
1 parent bd82a20 commit eb91ee5

File tree

1 file changed

+35
-17
lines changed

1 file changed

+35
-17
lines changed

.github/workflows/release.yml

Lines changed: 35 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,42 @@
11
# https://github.com/svenstaro/proxyboi/blob/fd1b493d2c2a341205d669cbf6bd549c5731df63/.github/workflows/publish.yml
22

33
on:
4-
push:
5-
tags:
6-
- 'v*.*.*'
4+
release:
5+
# Only use the types keyword to narrow down the activity types that will trigger your workflow.
6+
types: [published, created, edited]
77

88
name: Publish
99

1010
jobs:
11-
publish:
11+
normal-compile-publish:
1212
name: Publish
1313
runs-on: ${{ matrix.os }}
1414
strategy:
1515
matrix:
1616
os: [ubuntu-latest, windows-latest, macos-latest]
1717
include:
1818
- os: ubuntu-latest
19-
artifact_name: crypto-learn-backend
20-
release_name: crypto-learn-backend-linux-amd64
19+
artifact_name: cryptography-learning-backend
20+
release_name: cryptography-learning-backend-linux-ubuntu-amd64
2121
- os: windows-latest
22-
artifact_name: crypto-learn-backend.exe
23-
release_name: crypto-learn-backend-windows-amd64.exe
22+
artifact_name: cryptography-learning-backend.exe
23+
release_name: cryptography-learning-backend-windows-amd64.exe
2424
- os: macos-latest
25-
artifact_name: crypto-learn-backend
26-
release_name: crypto-learn-backend-macos-amd64
25+
artifact_name: cryptography-learning-backend
26+
release_name: cryptography-learning-backend-macos-amd64
2727

2828
steps:
2929
- uses: actions/checkout@v2
30-
3130
- uses: actions-rs/toolchain@v1
3231
with:
3332
toolchain: stable
3433
target: ${{ matrix.target }}
3534
override: true
36-
3735
- uses: actions-rs/cargo@v1
3836
with:
3937
use-cross: true
4038
command: build
4139
args: --release
42-
4340
- name: Upload binaries to release
4441
uses: svenstaro/upload-release-action@v1-release
4542
with:
@@ -48,7 +45,7 @@ jobs:
4845
asset_name: ${{ matrix.release_name }}
4946
tag: ${{ github.ref }}
5047

51-
cross_compile_publish:
48+
cross-compile-publish:
5249
name: Cross compile publish
5350
runs-on: ubuntu-latest
5451
strategy:
@@ -71,6 +68,27 @@ jobs:
7168
uses: svenstaro/upload-release-action@v1-release
7269
with:
7370
repo_token: ${{ secrets.GITHUB_TOKEN }}
74-
file: target/${{ matrix.target }}/release/crypto-learn-backend
75-
asset_name: crypto-learn-backend-${{ matrix.target }}
76-
tag: ${{ github.ref }}
71+
file: target/${{ matrix.target }}/release/cryptography-learning-backend
72+
asset_name: cryptography-learning-backend-${{ matrix.target }}
73+
tag: ${{ github.ref }}
74+
75+
static-compile-publish:
76+
name: Static build publish on Linux
77+
runs-on: ubuntu-latest
78+
env:
79+
CARGO_TERM_COLOR: always
80+
BUILD_TARGET: x86_64-unknown-linux-musl
81+
BINARY_NAME: cryptography-learning-backend-x86_64-linux-unknown-musl
82+
steps:
83+
- uses: actions/checkout@v2
84+
- name: Static build
85+
uses: gmiam/rust-musl-action@master
86+
with:
87+
args: cargo build --target $BUILD_TARGET --release
88+
- uses: svenstaro/upload-release-action@v1-release
89+
with:
90+
repo_token: ${{ secrets.GITHUB_TOKEN }}
91+
file: target/${{ env.BUILD_TARGET }}/release/cryptography-learning-backend
92+
asset_name: ${{ env.BINARY_NAME }}
93+
tag: ${{ github.ref }}
94+

0 commit comments

Comments
 (0)