Skip to content

Commit 3de888e

Browse files
committed
Try adding new releases
1 parent 0230260 commit 3de888e

File tree

1 file changed

+82
-13
lines changed

1 file changed

+82
-13
lines changed

.github/workflows/release.yml

Lines changed: 82 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -1,28 +1,97 @@
1+
name: Release
2+
13
on:
24
release:
35
types: [created]
46

7+
env:
8+
CARGO_TERM_COLOR: always
9+
510
jobs:
611
release:
7-
name: release ${{ matrix.target }}
8-
runs-on: ubuntu-latest
12+
name: Release ${{ matrix.target }}
13+
runs-on: ${{ matrix.os }}
914
strategy:
1015
fail-fast: false
1116
matrix:
1217
include:
13-
- target: x86_64-pc-windows-gnu
18+
# x86_64 targets
19+
- os: ubuntu-latest
20+
target: x86_64-unknown-linux-musl
21+
use_cross: false
22+
archive: tar.gz
23+
- os: macos-latest
24+
target: x86_64-apple-darwin
25+
use_cross: false
1426
archive: zip
15-
- target: x86_64-unknown-linux-musl
16-
archive: tar.gz tar.xz tar.zst
17-
- target: x86_64-apple-darwin
27+
28+
# aarch64 (ARM64) targets
29+
- os: ubuntu-latest
30+
target: aarch64-unknown-linux-musl
31+
use_cross: true
32+
archive: tar.gz
33+
- os: macos-latest
34+
target: aarch64-apple-darwin
35+
use_cross: false
1836
archive: zip
37+
1938
steps:
20-
- uses: actions/checkout@master
21-
- name: Compile and release
22-
uses: rust-build/[email protected]
39+
- name: Checkout
40+
uses: actions/checkout@v4
41+
42+
- name: Install Rust
43+
uses: dtolnay/rust-toolchain@stable
44+
with:
45+
targets: ${{ matrix.target }}
46+
47+
- name: Install cross
48+
if: matrix.use_cross
49+
run: |
50+
cargo install cross --git https://github.com/cross-rs/cross
51+
echo "CARGO=cross" >> $GITHUB_ENV
52+
53+
- name: Set cargo
54+
if: "!matrix.use_cross"
55+
run: echo "CARGO=cargo" >> $GITHUB_ENV
56+
57+
- name: Build
58+
run: |
59+
cd temoc
60+
${{ env.CARGO }} build --release --target ${{ matrix.target }}
61+
62+
- name: Package (tar.gz)
63+
if: matrix.archive == 'tar.gz'
64+
run: |
65+
cd temoc/target/${{ matrix.target }}/release
66+
tar czf ../../../../temoc-${{ matrix.target }}.tar.gz temoc
67+
cd ../../../..
68+
echo "ASSET=temoc-${{ matrix.target }}.tar.gz" >> $GITHUB_ENV
69+
70+
- name: Package (zip - Unix)
71+
if: matrix.archive == 'zip' && runner.os != 'Windows'
72+
run: |
73+
cd temoc/target/${{ matrix.target }}/release
74+
if [ -f temoc ]; then
75+
zip ../../../../temoc-${{ matrix.target }}.zip temoc
76+
else
77+
zip ../../../../temoc-${{ matrix.target }}.zip temoc.exe
78+
fi
79+
cd ../../../..
80+
echo "ASSET=temoc-${{ matrix.target }}.zip" >> $GITHUB_ENV
81+
82+
- name: Package (zip - Windows)
83+
if: matrix.archive == 'zip' && runner.os == 'Windows'
84+
shell: bash
85+
run: |
86+
cd temoc/target/${{ matrix.target }}/release
87+
7z a ../../../../temoc-${{ matrix.target }}.zip temoc.exe
88+
cd ../../../..
89+
echo "ASSET=temoc-${{ matrix.target }}.zip" >> $GITHUB_ENV
90+
91+
- name: Upload Release Asset
92+
uses: softprops/action-gh-release@v1
93+
if: startsWith(github.ref, 'refs/tags/')
94+
with:
95+
files: ${{ env.ASSET }}
2396
env:
2497
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
25-
with:
26-
SRC_DIR: ./temoc/
27-
RUSTTARGET: ${{ matrix.target }}
28-
ARCHIVE_TYPES: ${{ matrix.archive }}

0 commit comments

Comments
 (0)