-
Notifications
You must be signed in to change notification settings - Fork 0
74 lines (64 loc) · 2.26 KB
/
Copy pathrelease.yml
File metadata and controls
74 lines (64 loc) · 2.26 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
name: Release
on:
push:
tags: ["v*"]
permissions:
contents: write
jobs:
build:
name: build (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
- os: macos-latest
target: aarch64-apple-darwin
- os: macos-latest
target: x86_64-apple-darwin
- os: windows-latest
target: x86_64-pc-windows-msvc
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl tools
if: contains(matrix.target, 'musl')
run: sudo apt-get update && sudo apt-get install -y musl-tools
- uses: Swatinem/rust-cache@v2
with:
key: ${{ matrix.target }}
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package (unix)
if: runner.os != 'Windows'
run: |
NAME="thoth-${GITHUB_REF_NAME}-${{ matrix.target }}"
mkdir "$NAME"
cp "target/${{ matrix.target }}/release/thoth" README.md LICENSE-MIT LICENSE-APACHE "$NAME/"
tar -czf "$NAME.tar.gz" "$NAME"
(sha256sum "$NAME.tar.gz" 2>/dev/null || shasum -a 256 "$NAME.tar.gz") > "$NAME.tar.gz.sha256"
- name: Package (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
$name = "thoth-$env:GITHUB_REF_NAME-${{ matrix.target }}"
New-Item -ItemType Directory $name | Out-Null
Copy-Item "target/${{ matrix.target }}/release/thoth.exe", README.md, LICENSE-MIT, LICENSE-APACHE $name
Compress-Archive -Path "$name/*" -DestinationPath "$name.zip"
$hash = (Get-FileHash "$name.zip" -Algorithm SHA256).Hash.ToLower()
"$hash $name.zip" | Out-File -Encoding ascii "$name.zip.sha256"
- name: Upload to release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: |
thoth-*.tar.gz
thoth-*.tar.gz.sha256
thoth-*.zip
thoth-*.zip.sha256