Repository navigation
89 lines (80 loc) · 3.03 KB
/
Copy pathrelease.yml
File metadata and controls
89 lines (80 loc) · 3.03 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
name: release
on:
push:
tags: ["v*"]
workflow_dispatch:
inputs:
tag:
description: "Tag to build (e.g. v0.1.0)"
required: true
permissions:
contents: write
jobs:
# Nothing is published before the gates that guard every pull request pass on the
# exact commit being released. A green tag that was never tested is worse than no tag.
verify:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
components: rustfmt, clippy
- uses: Swatinem/rust-cache@v2
- run: cargo fmt --all -- --check
- run: cargo clippy --all-targets -- -D warnings
- run: cargo test --all
binaries:
needs: verify
strategy:
fail-fast: false
matrix:
include:
- { os: macos-latest, target: aarch64-apple-darwin }
- { os: macos-latest, target: x86_64-apple-darwin }
- { os: ubuntu-latest, target: x86_64-unknown-linux-gnu }
- { os: ubuntu-latest, target: aarch64-unknown-linux-gnu }
# Mature business systems are disproportionately maintained on Windows,
# which is exactly the codebase this tool is for.
- { os: windows-latest, target: x86_64-pc-windows-msvc, ext: .exe }
runs-on: ${{ matrix.os }}
steps:
- uses: actions/checkout@v4
- uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- uses: Swatinem/rust-cache@v2
- name: Cross-compilation linker
if: matrix.target == 'aarch64-unknown-linux-gnu'
run: |
sudo apt-get update && sudo apt-get install -y gcc-aarch64-linux-gnu
echo "CARGO_TARGET_AARCH64_UNKNOWN_LINUX_GNU_LINKER=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
echo "CC_aarch64_unknown_linux_gnu=aarch64-linux-gnu-gcc" >> "$GITHUB_ENV"
- run: cargo build --release --target ${{ matrix.target }} -p reify-cli
- name: Package
shell: bash
run: |
NAME="reify-${{ github.ref_name || inputs.tag }}-${{ matrix.target }}"
mkdir -p "dist/$NAME"
cp "target/${{ matrix.target }}/release/reify${{ matrix.ext }}" "dist/$NAME/"
cp README.md LICENSE "dist/$NAME/"
tar -C dist -czf "dist/$NAME.tar.gz" "$NAME"
shasum -a 256 "dist/$NAME.tar.gz" > "dist/$NAME.tar.gz.sha256" 2>/dev/null \
|| sha256sum "dist/$NAME.tar.gz" > "dist/$NAME.tar.gz.sha256"
- uses: actions/upload-artifact@v4
with:
name: ${{ matrix.target }}
path: dist/*.tar.gz*
publish:
needs: binaries
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/download-artifact@v4
with: { path: dist, merge-multiple: true }
- uses: softprops/action-gh-release@v2
with:
files: dist/*
generate_release_notes: true
# Draft until a human has looked at it. A release is outward-facing and
# should not appear because a tag was pushed by accident.
draft: true