-
Notifications
You must be signed in to change notification settings - Fork 5
107 lines (93 loc) · 3.25 KB
/
Copy pathrelease.yml
File metadata and controls
107 lines (93 loc) · 3.25 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
name: Release
on:
push:
tags:
- "v*"
permissions:
contents: write
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: "true"
jobs:
build:
name: Build Release (${{ matrix.target }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
target: x86_64-unknown-linux-musl
- os: macos-latest
target: aarch64-apple-darwin
steps:
- name: Checkout
uses: actions/checkout@v7
# Release artifacts are built with a plain toolchain, NOT `nix develop`.
# Building inside the dev shell links against /nix/store paths, which do
# not exist on user machines: every release up to v0.1.0-alpha.3 shipped
# a Linux binary whose ELF interpreter was a /nix/store glibc, and a
# macOS binary loading /nix/store libiconv. Both failed to start off Nix.
# CI checks still use Nix; only packaging is plain.
- name: Install Rust toolchain
uses: dtolnay/rust-toolchain@stable
with:
targets: ${{ matrix.target }}
- name: Install musl tooling
if: matrix.os == 'ubuntu-latest'
run: sudo apt-get update -qq && sudo apt-get install -y musl-tools musl-dev
- name: Build release CLI
run: cargo build -p flutterdec-cli --release --target ${{ matrix.target }}
- name: Verify artifact is portable
shell: bash
run: |
set -euo pipefail
bin="target/${{ matrix.target }}/release/flutterdec"
if [ "${{ runner.os }}" = "Linux" ]; then
# musl static-pie: `file` reports "static-pie linked". Anything
# dynamic would name an ELF interpreter, which is exactly the
# /nix/store breakage this guard exists to catch.
if ! file "$bin" | grep -q 'static'; then
echo "::error::expected a static binary"
file "$bin"
exit 1
fi
else
if otool -L "$bin" | grep -q '/nix/store'; then
echo "::error::binary links against /nix/store"
otool -L "$bin"
exit 1
fi
fi
"$bin" --version
- name: Package artifact
shell: bash
run: |
set -euo pipefail
os="${{ runner.os }}"
arch="${{ runner.arch }}"
out_dir="dist"
mkdir -p "$out_dir"
archive="$out_dir/flutterdec-${{ github.ref_name }}-${os}-${arch}.tar.gz"
tar -C "target/${{ matrix.target }}/release" -czf "$archive" flutterdec
echo "archive=$archive" >> "$GITHUB_ENV"
- name: Upload artifact
uses: actions/upload-artifact@v7
with:
name: flutterdec-${{ github.ref_name }}-${{ runner.os }}-${{ runner.arch }}
path: ${{ env.archive }}
publish:
name: Publish GitHub Release
runs-on: ubuntu-latest
needs: build
steps:
- name: Download artifacts
uses: actions/download-artifact@v8
with:
path: dist
merge-multiple: true
- name: Publish release
uses: softprops/action-gh-release@v3
with:
files: dist/*.tar.gz
generate_release_notes: true
prerelease: ${{ contains(github.ref_name, '-') }}