-
Notifications
You must be signed in to change notification settings - Fork 4
130 lines (112 loc) · 3.62 KB
/
Copy pathrelease.yml
File metadata and controls
130 lines (112 loc) · 3.62 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
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Release
on:
push:
tags:
- 'v*'
env:
CARGO_TERM_COLOR: always
# Default: only read. Jobs opt into write where needed.
permissions:
contents: read
jobs:
build:
name: build ${{ matrix.target }}
runs-on: ubuntu-latest
# aarch64 (musl) is best-effort; a failure there must not block the x86_64 release.
continue-on-error: ${{ matrix.best_effort }}
strategy:
fail-fast: false
matrix:
include:
- target: x86_64-unknown-linux-gnu
cross: false
best_effort: false
- target: aarch64-unknown-linux-musl
cross: true
best_effort: true
steps:
- uses: actions/checkout@v7
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libfuse3-dev libssl-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install cross
if: matrix.cross
run: cargo install cross --locked
- name: Build (native)
if: ${{ !matrix.cross }}
run: cargo build --release --locked --target ${{ matrix.target }} --bin scorpio --bin antares
- name: Build (cross)
if: matrix.cross
run: cross build --release --locked --target ${{ matrix.target }} --bin scorpio --bin antares
- name: Package tarball + checksum
run: |
set -euo pipefail
version="${GITHUB_REF_NAME}"
dist="scorpiofs-${version}-${{ matrix.target }}"
mkdir -p "$dist"
cp "target/${{ matrix.target }}/release/scorpio" "$dist/"
cp "target/${{ matrix.target }}/release/antares" "$dist/"
cp LICENSE-MIT LICENSE-APACHE README.md "$dist/"
tar -czf "${dist}.tar.gz" "$dist"
sha256sum "${dist}.tar.gz" > "${dist}.tar.gz.sha256"
- name: Upload build artifacts
uses: actions/upload-artifact@v7
with:
name: dist-${{ matrix.target }}
path: |
scorpiofs-*.tar.gz
scorpiofs-*.tar.gz.sha256
if-no-files-found: error
release:
name: Publish GitHub Release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist
pattern: dist-*
merge-multiple: true
- name: Combined SHA256SUMS
run: |
set -euo pipefail
cd dist
sha256sum *.tar.gz > SHA256SUMS
cat SHA256SUMS
- name: Create / update GitHub Release
uses: softprops/action-gh-release@v3
with:
files: |
dist/*.tar.gz
dist/*.tar.gz.sha256
dist/SHA256SUMS
generate_release_notes: true
fail_on_unmatched_files: true
publish-crate:
name: Publish to crates.io
needs: release
runs-on: ubuntu-latest
# Protected environment: configure a required reviewer in GitHub so crate
# publishing requires manual approval and is NOT triggered automatically by
# an ordinary tag push.
environment: crates-io
steps:
- uses: actions/checkout@v7
- name: Install build dependencies
run: |
sudo apt-get update
sudo apt-get install -y --no-install-recommends pkg-config libfuse3-dev libssl-dev
- name: Install Rust
uses: dtolnay/rust-toolchain@stable
- name: cargo publish
env:
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
run: cargo publish --locked