-
Notifications
You must be signed in to change notification settings - Fork 3
95 lines (79 loc) · 3.07 KB
/
Copy pathrelease-sce-linux.yml
File metadata and controls
95 lines (79 loc) · 3.07 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
name: Release sce CLI (Linux)
on:
workflow_call:
inputs:
release_ref:
required: true
type: string
release_version:
required: true
type: string
permissions:
contents: read
jobs:
build-linux-artifacts:
runs-on: ubuntu-latest
steps:
- name: Harden the runner (Audit all outbound calls)
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
with:
egress-policy: audit
- name: Check out repository
uses: actions/checkout@9c091bb21b7c1c1d1991bb908d89e4e9dddfe3e0 # v7.0.0
with:
ref: ${{ inputs.release_ref }}
- name: Install Nix
uses: DeterminateSystems/nix-installer-action@ef8a148080ab6020fd15196c2084a2eea5ff2d25 # v22
- name: Build canonical Linux CLI release artifacts
run: |
nix run .#release-artifacts -- \
--version "${{ inputs.release_version }}" \
--out-dir dist
- name: Validate packaged Linux CLI release artifact
run: |
set -euo pipefail
version="${{ inputs.release_version }}"
target_triple="x86_64-unknown-linux-musl"
archive_root="sce-v${version}-${target_triple}"
archive_path="dist/${archive_root}.tar.gz"
if [ ! -f "$archive_path" ]; then
printf 'Expected release archive at %s\n' "$archive_path" >&2
exit 1
fi
extract_dir="$(mktemp -d "${RUNNER_TEMP:-/tmp}/sce-release-validate.XXXXXX")"
cleanup() {
rm -rf "$extract_dir"
}
trap cleanup EXIT
tar -xzf "$archive_path" -C "$extract_dir"
release_binary="$extract_dir/$archive_root/bin/sce"
if [ ! -x "$release_binary" ]; then
printf 'Expected executable release binary at %s\n' "$release_binary" >&2
exit 1
fi
"$release_binary" version --format json
nix run .#native-portability-audit -- --platform linux --binary "$release_binary"
- name: Allow Flatpak build sandbox
run: |
sudo sysctl -w kernel.unprivileged_userns_clone=1
if [ -e /proc/sys/kernel/apparmor_restrict_unprivileged_userns ]; then
sudo sysctl -w kernel.apparmor_restrict_unprivileged_userns=0
fi
- name: Build Flatpak bundle release assets (x86_64)
run: |
nix run .#release-flatpak-bundle -- \
--version "${{ inputs.release_version }}" \
--arch x86_64 \
--out-dir dist/flatpak-bundle
- name: Upload Flatpak bundle release assets (x86_64)
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sce-flatpak-bundle-x86_64
path: dist/flatpak-bundle/
if-no-files-found: error
- name: Upload Linux CLI release artifacts
uses: actions/upload-artifact@043fb46d1a93c77aae656e7c1c64a875d1fc6a0a # v7.0.1
with:
name: sce-release-x86_64-unknown-linux-musl
path: dist/
if-no-files-found: error