-
Notifications
You must be signed in to change notification settings - Fork 0
103 lines (85 loc) · 2.83 KB
/
Copy pathrelease.yaml
File metadata and controls
103 lines (85 loc) · 2.83 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
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: release
on:
push:
tags:
- 'v*'
workflow_dispatch:
permissions:
contents: write
jobs:
build:
name: Build (${{ matrix.os }} / ${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
matrix:
include:
- os: ubuntu-24.04
target: x86_64-unknown-linux-musl
setup: sudo apt-get install musl-tools
- os: ubuntu-24.04-arm
target: aarch64-unknown-linux-musl
setup: sudo apt-get install musl-tools
linker: CARGO_TARGET_AARCH64_UNKNOWN_LINUX_MUSL_LINKER=musl-gcc
- os: windows-2022
target: x86_64-pc-windows-msvc
setup: git config --global core.longpaths true
- os: macos-15-intel
target: x86_64-apple-darwin
setup: ""
- os: macos-15
target: aarch64-apple-darwin
setup: ""
steps:
- uses: actions/checkout@v4
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@v1
with:
toolchain: stable
target: ${{ matrix.target }}
- name: Install dependencies
if: matrix.setup != ''
run: ${{ matrix.setup }}
- name: Set linker
if: matrix.linker != ''
run: echo "${{ matrix.linker }}" >> $GITHUB_ENV
- name: Build release
run: cargo build --release --target ${{ matrix.target }}
- name: Build archive
shell: bash
run: |
VERSION="${GITHUB_REF#refs/tags/}"
if [ "${{ matrix.os }}" = "windows-2022" ]; then
ARCHIVE="spython-$VERSION-${{ matrix.target }}.zip"
cp "target/${{ matrix.target }}/release/spython.exe" "spython.exe"
7z a "$ARCHIVE" "spython.exe"
rm spython.exe
else
ARCHIVE="spython-$VERSION-${{ matrix.target }}.tar.gz"
cp "target/${{ matrix.target }}/release/spython" "spython"
tar -czvf "$ARCHIVE" "spython"
rm spython
fi
openssl dgst -r -sha256 -out "$ARCHIVE".sha256 "$ARCHIVE"
echo "ASSET=$ARCHIVE" >> $GITHUB_ENV
- name: Ensure binary successfully boots
shell: bash
run: |
case "${{ matrix.target }}" in
x86_64-pc-windows-msvc)
7z x "$ASSET"
./spython.exe --version ;;
*)
tar -xvzf "$ASSET"
./spython --version ;;
esac
- name: Upload release archive
# https://github.com/softprops/action-gh-release/issues/445
# uses: softprops/action-gh-release@v2
uses: softprops/action-gh-release@0bd7e8b279c9b5b36661d552472fbbfe671fe26e
with:
draft: true
prerelease: false
fail_on_unmatched_files: true
files: |
${{ env.ASSET }}
${{ env.ASSET }}.sha256