Skip to content

Commit ee6c674

Browse files
committed
feat: use rust-simple-release CI
Signed-off-by: lxl66566 <lxl66566@gmail.com>
1 parent 0a9797b commit ee6c674

File tree

1 file changed

+6
-93
lines changed

1 file changed

+6
-93
lines changed

.github/workflows/release.yml

Lines changed: 6 additions & 93 deletions
Original file line numberDiff line numberDiff line change
@@ -1,106 +1,19 @@
1-
name: Build/publish release
2-
1+
name: rust release action
32
on:
43
push:
54
tags:
65
- "v*"
7-
workflow_dispatch:
86

97
jobs:
10-
create-release:
11-
if: (startsWith(github.ref_name, 'v') && github.ref_type == 'tag')
12-
runs-on: ubuntu-latest
13-
steps:
14-
- uses: actions/checkout@v4
15-
- uses: taiki-e/create-gh-release-action@v1
16-
with:
17-
title: $version
18-
token: ${{ secrets.GH_TOKEN }}
19-
208
release:
21-
name: Binary ${{ matrix.target }} (on ${{ matrix.os }})
22-
continue-on-error: false
9+
runs-on: ${{ matrix.os }}
2310
strategy:
2411
matrix:
25-
include:
26-
- os: ubuntu-latest
27-
target: x86_64-unknown-linux-gnu
28-
compress: true
29-
- os: ubuntu-latest
30-
target: aarch64-unknown-linux-gnu
31-
compress: true
32-
- os: ubuntu-latest
33-
target: x86_64-unknown-linux-musl
34-
compress: true
35-
- os: ubuntu-latest
36-
target: aarch64-unknown-linux-musl
37-
compress: true
38-
- os: windows-latest
39-
compress: true
40-
- os: macos-latest
41-
target: x86_64-apple-darwin
42-
compress: true
43-
- os: macos-latest
44-
target: aarch64-apple-darwin
45-
compress: true
46-
- os: ubuntu-latest
47-
target: x86_64-unknown-freebsd
48-
compress: true
49-
50-
# The type of runner that the job will run on
51-
# Runs on Ubuntu if other os is not specified above
52-
runs-on: ${{ matrix.os || 'ubuntu-latest' }}
53-
timeout-minutes: 90
54-
permissions:
55-
contents: write
56-
57-
env:
58-
SCCACHE_GHA_ENABLED: "true"
59-
RUSTC_WRAPPER: "sccache"
12+
os: [ubuntu-latest, windows-latest, macos-latest]
6013
steps:
6114
- uses: actions/checkout@v4
62-
63-
- name: create version file
64-
if: (startsWith(github.ref_name, 'v') && github.ref_type == 'tag')
65-
run: echo "${{github.ref_name}}" | tail -c+2 >> .build_version
66-
67-
- name: Get version from tag
68-
id: extract_version
69-
run: |
70-
echo "version=${GITHUB_REF_NAME#v}" >> "$GITHUB_OUTPUT"
71-
shell: bash
72-
73-
- name: Setup Rust toolchain
74-
# uses: dtolnay/rust-toolchain@nightly
75-
uses: actions-rs/toolchain@v1
76-
with:
77-
toolchain: nightly
78-
override: true
79-
80-
- name: Run sccache-cache
81-
uses: mozilla-actions/sccache-action@v0.0.5
82-
83-
- run: sudo apt install musl-tools
84-
if: startsWith(matrix.os, 'ubuntu')
85-
86-
- name: Install openssl on ubuntu if needed
87-
if: startsWith(matrix.os, 'ubuntu')
88-
run: grep -q 'openssl' 'Cargo.lock' && sudo apt install pkg-config libssl-dev || true
89-
- name: Install openssl on macos if needed
90-
if: startsWith(matrix.os, 'macos')
91-
run: grep -q 'openssl' 'Cargo.lock' && brew install openssl || true
92-
# - name: Set Perl environment variables
93-
# if: runner.os == 'Windows'
94-
# run: |
95-
# # choco install openssl strawberryperl
96-
# echo "PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
97-
# echo "OPENSSL_SRC_PERL=$((where.exe perl)[0])" | Out-File -FilePath $env:GITHUB_ENV -Append -Encoding utf8
98-
99-
- name: Build and Upload
100-
uses: taiki-e/upload-rust-binary-action@v1
15+
- name: release rust project
16+
uses: lxl66566/rust-simple-release@main
10117
with:
102-
bin: git-se
103-
target: ${{ matrix.target }}
104-
tar: unix
105-
zip: windows
18+
targets: aarch64-unknown-linux-gnu, aarch64-unknown-linux-musl, x86_64-pc-windows-msvc, x86_64-unknown-linux-musl, x86_64-unknown-linux-gnu, aarch64-apple-darwin, x86_64-apple-darwin
10619
token: ${{ secrets.GH_TOKEN }}

0 commit comments

Comments
 (0)