|
1 | | -name: Build/publish release |
2 | | - |
| 1 | +name: rust release action |
3 | 2 | on: |
4 | 3 | push: |
5 | 4 | tags: |
6 | 5 | - "v*" |
7 | | - workflow_dispatch: |
8 | 6 |
|
9 | 7 | 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 | | - |
20 | 8 | release: |
21 | | - name: Binary ${{ matrix.target }} (on ${{ matrix.os }}) |
22 | | - continue-on-error: false |
| 9 | + runs-on: ${{ matrix.os }} |
23 | 10 | strategy: |
24 | 11 | 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] |
60 | 13 | steps: |
61 | 14 | - 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 |
101 | 17 | 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 |
106 | 19 | token: ${{ secrets.GH_TOKEN }} |
0 commit comments