-
Notifications
You must be signed in to change notification settings - Fork 1
89 lines (74 loc) · 2.47 KB
/
release.yml
File metadata and controls
89 lines (74 loc) · 2.47 KB
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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: macos-14
target: aarch64-apple-darwin
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
env:
ASSET_BASENAME: gitee-${{ github.ref_name }}-${{ matrix.target }}
steps:
- name: Check out repository
uses: actions/checkout@v4
- name: Read Rust version
id: rust-version
run: echo "version=$(awk '/^rust / { print $2 }' .tool-versions)" >> "$GITHUB_OUTPUT"
- name: Install Rust toolchain
run: |
rustup toolchain install "${{ steps.rust-version.outputs.version }}" --profile minimal
rustup default "${{ steps.rust-version.outputs.version }}"
rustup target add "${{ matrix.target }}"
- name: Install musl tools
if: matrix.target == 'x86_64-unknown-linux-musl'
run: |
sudo apt-get update
sudo apt-get install -y musl-tools
- name: Build release binary
run: cargo build --locked --release --target "${{ matrix.target }}"
- name: Package release archive
run: |
mkdir -p "dist/${ASSET_BASENAME}"
cp "target/${{ matrix.target }}/release/gitee" "dist/${ASSET_BASENAME}/gitee"
cp LICENSE README.md README_CN.md "dist/${ASSET_BASENAME}/"
tar -C dist -czf "dist/${ASSET_BASENAME}.tar.gz" "${ASSET_BASENAME}"
- name: Upload release archive
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: dist/${{ env.ASSET_BASENAME }}.tar.gz
if-no-files-found: error
publish:
needs: build
runs-on: ubuntu-latest
steps:
- name: Download release archives
uses: actions/download-artifact@v4
with:
path: release-assets
merge-multiple: true
- name: Generate checksums
run: |
cd release-assets
shasum -a 256 *.tar.gz > "gitee-${GITHUB_REF_NAME}-checksums.txt"
- name: Create or update draft GitHub release
uses: softprops/action-gh-release@v2
with:
draft: true
generate_release_notes: true
overwrite_files: true
fail_on_unmatched_files: true
working_directory: release-assets
files: |
*.tar.gz
gitee-${{ github.ref_name }}-checksums.txt