|
1 |
| -name: Deploy |
| 1 | +name: Release |
| 2 | + |
| 3 | +permissions: |
| 4 | + contents: write |
2 | 5 |
|
3 | 6 | on:
|
4 | 7 | push:
|
5 | 8 | tags:
|
6 |
| - - "[0-9]+.[0-9]+.[0-9]+" |
7 |
| - |
8 |
| -permissions: |
9 |
| - contents: write |
| 9 | + - v[0-9]+.* |
10 | 10 |
|
11 | 11 | jobs:
|
12 |
| - build-and-upload: |
13 |
| - name: Build and upload |
14 |
| - runs-on: ${{ matrix.os }} |
| 12 | + create-release: |
| 13 | + runs-on: ubuntu-latest |
| 14 | + steps: |
| 15 | + - uses: actions/checkout@v4 |
| 16 | + - uses: taiki-e/create-gh-release-action@v1 |
| 17 | + with: |
| 18 | + # (optional) Path to changelog. |
| 19 | + changelog: CHANGELOG.md |
| 20 | + # (required) GitHub token for creating GitHub Releases. |
| 21 | + token: ${{ secrets.GITHUB_TOKEN }} |
15 | 22 |
|
| 23 | + upload-assets: |
| 24 | + needs: create-release |
16 | 25 | strategy:
|
17 | 26 | matrix:
|
18 |
| - # You can add more, for any target you'd like! |
19 | 27 | include:
|
20 |
| - - build: linux |
| 28 | + - target: x86_64-unknown-linux-gnu |
21 | 29 | os: ubuntu-latest
|
22 |
| - target: x86_64-unknown-linux-musl |
23 |
| - |
24 |
| - - build: macos |
| 30 | + - target: x86_64-apple-darwin |
25 | 31 | os: macos-latest
|
26 |
| - target: x86_64-apple-darwin |
27 |
| - |
| 32 | + - target: x86_64-pc-windows-msvc |
| 33 | + os: windows-latest |
| 34 | + runs-on: ${{ matrix.os }} |
28 | 35 | steps:
|
29 |
| - - name: Checkout |
30 |
| - uses: actions/checkout@v3 |
31 |
| - |
32 |
| - - name: Get the release version from the tag |
33 |
| - shell: bash |
34 |
| - run: echo "VERSION=${GITHUB_REF#refs/tags/}" >> $GITHUB_ENV |
35 |
| - |
36 |
| - - name: Install Rust |
37 |
| - # Or @nightly if you want |
38 |
| - |
39 |
| - # Arguments to pass in |
40 |
| - with: |
41 |
| - # Make Rust compile to our target (defined in the matrix) |
42 |
| - targets: ${{ matrix.target }} |
43 |
| - |
44 |
| - - name: Build |
45 |
| - uses: actions-rs/cargo@v1 |
46 |
| - with: |
47 |
| - use-cross: true |
48 |
| - command: build |
49 |
| - args: --verbose --release --target ${{ matrix.target }} |
50 |
| - |
51 |
| - - name: Build archive |
52 |
| - shell: bash |
53 |
| - run: | |
54 |
| - # Replace with the name of your binary |
55 |
| - binary_name="rae-cli" |
56 |
| -
|
57 |
| - dirname="$binary_name-${{ env.VERSION }}-${{ matrix.target }}" |
58 |
| - mkdir "$dirname" |
59 |
| - if [ "${{ matrix.os }}" = "windows-latest" ]; then |
60 |
| - mv "target/${{ matrix.target }}/release/$binary_name.exe" "$dirname" |
61 |
| - else |
62 |
| - mv "target/${{ matrix.target }}/release/$binary_name" "$dirname" |
63 |
| - fi |
64 |
| -
|
65 |
| - if [ "${{ matrix.os }}" = "windows-latest" ]; then |
66 |
| - 7z a "$dirname.zip" "$dirname" |
67 |
| - echo "ASSET=$dirname.zip" >> $GITHUB_ENV |
68 |
| - else |
69 |
| - tar -czf "$dirname.tar.gz" "$dirname" |
70 |
| - echo "ASSET=$dirname.tar.gz" >> $GITHUB_ENV |
71 |
| - fi |
72 |
| -
|
73 |
| - - name: Release |
74 |
| - uses: softprops/action-gh-release@v1 |
| 36 | + - uses: actions/checkout@v4 |
| 37 | + - uses: taiki-e/upload-rust-binary-action@v1 |
75 | 38 | with:
|
76 |
| - files: | |
77 |
| - ${{ env.ASSET }} |
| 39 | + # (required) Comma-separated list of binary names (non-extension portion of filename) to build and upload. |
| 40 | + # Note that glob pattern is not supported yet. |
| 41 | + bin: ... |
| 42 | + # (optional) Target triple, default is host triple. |
| 43 | + # This is optional but it is recommended that this always be set to |
| 44 | + # clarify which target you are building for if macOS is included in |
| 45 | + # the matrix because GitHub Actions changed the default architecture |
| 46 | + # of macos-latest since macos-14. |
| 47 | + target: ${{ matrix.target }} |
| 48 | + # (optional) On which platform to distribute the `.tar.gz` file. |
| 49 | + # [default value: unix] |
| 50 | + # [possible values: all, unix, windows, none] |
| 51 | + tar: unix |
| 52 | + # (optional) On which platform to distribute the `.zip` file. |
| 53 | + # [default value: windows] |
| 54 | + # [possible values: all, unix, windows, none] |
| 55 | + zip: windows |
| 56 | + # (required) GitHub token for uploading assets to GitHub Releases. |
| 57 | + token: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments