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
name: Release
on:
push:
tags:
workflow_dispatch:
permissions:
contents: read
jobs:
build:
name: ${{ matrix.target }}
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-gnu
- os: macos-latest
target: aarch64-apple-darwin
# Intel-mac runners (macos-13) are retired; cross-compile on Apple Silicon.
- 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 }}
- uses: Swatinem/rust-cache@v2
- run: cargo build --release --locked --target ${{ matrix.target }}
- name: Package (unix)
if: runner.os != 'Windows'
run: |
mkdir -p dist
tar czf dist/emperor-folder-${{ github.ref_name }}-${{ matrix.target }}.tar.gz \
-C target/${{ matrix.target }}/release emperor-folder
- name: Package (windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
New-Item -ItemType Directory -Force dist | Out-Null
Compress-Archive -Path target/${{ matrix.target }}/release/emperor-folder.exe `
-DestinationPath "dist/emperor-folder-${{ github.ref_name }}-${{ matrix.target }}.zip"
- uses: actions/upload-artifact@v4
with:
name: dist-${{ matrix.target }}
path: dist/*
publish:
name: checksums, attestations, release
needs: build
runs-on: ubuntu-latest
permissions:
contents: write
id-token: write
attestations: write
steps:
- uses: actions/download-artifact@v4
with:
pattern: dist-*
path: dist
merge-multiple: true
- name: SHA256SUMS
working-directory: dist
run: sha256sum emperor-folder-* > SHA256SUMS && cat SHA256SUMS
- name: Build provenance attestation
uses: actions/attest-build-provenance@v2
with:
subject-path: |
dist/emperor-folder-*
dist/SHA256SUMS
- name: Attach to release
if: startsWith(github.ref, 'refs/tags/')
uses: softprops/action-gh-release@v2
with:
prerelease: ${{ contains(github.ref_name, '-') }}
files: |
dist/emperor-folder-*
dist/SHA256SUMS