-
Notifications
You must be signed in to change notification settings - Fork 0
102 lines (90 loc) · 2.74 KB
/
release.yml
File metadata and controls
102 lines (90 loc) · 2.74 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
name: Release
on:
push:
tags:
- "v*"
jobs:
build:
name: build (${{ matrix.os }} / ${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
artifact_name: errat-linux-x86_64
binary_name: errat
- os: ubuntu-latest
target: aarch64-unknown-linux-gnu
artifact_name: errat-linux-aarch64
binary_name: errat
- os: macos-latest
target: x86_64-apple-darwin
artifact_name: errat-macos-x86_64
binary_name: errat
- os: macos-latest
target: aarch64-apple-darwin
artifact_name: errat-macos-aarch64
binary_name: errat
- os: windows-latest
target: x86_64-pc-windows-msvc
artifact_name: errat-windows-x86_64.exe
binary_name: errat.exe
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
- uses: Swatinem/rust-cache@v2
- name: Add target
run: rustup target add ${{ matrix.target }}
- name: Install aarch64 linker
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
- name: Build
run: cargo build --release --target ${{ matrix.target }}
- name: Package
shell: bash
run: |
mkdir -p dist
BIN="target/${{ matrix.target }}/release/${{ matrix.binary_name }}"
cp "$BIN" "dist/${{ matrix.artifact_name }}"
- name: SHA256
shell: bash
run: |
ART="dist/${{ matrix.artifact_name }}"
python - <<'PY'
import hashlib
from pathlib import Path
import os
path = Path(os.environ['ART'])
h = hashlib.sha256()
h.update(path.read_bytes())
path.with_suffix(path.suffix + '.sha256').write_text(f"{h.hexdigest()} {path.name}\n")
PY
env:
ART: dist/${{ matrix.artifact_name }}
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.artifact_name }}
path: |
dist/${{ matrix.artifact_name }}
dist/${{ matrix.artifact_name }}.sha256
release:
name: publish
runs-on: ubuntu-latest
needs: build
permissions:
contents: write
steps:
- uses: actions/download-artifact@v4
with:
path: dist
- name: Combine checksums
shell: bash
run: |
find dist -name "*.sha256" -type f -print0 | xargs -0 cat > dist/sha256sums.txt
- name: Create Release
uses: softprops/action-gh-release@v2
with:
generate_release_notes: true
files: dist/**