Repository navigation
141 lines (135 loc) · 4.92 KB
/
Copy pathpackage.yml
File metadata and controls
141 lines (135 loc) · 4.92 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
131
132
133
134
135
136
137
138
139
140
141
name: Package
# Builds installers: Windows (Inno Setup), Linux .deb, .rpm and AppImage.
# Runs manually, or from release.yml: once to validate a prepared release commit and
# once to attach the installers to the published release. A push to master builds no
# installers of its own; release.yml already builds them for that commit.
on:
workflow_dispatch:
workflow_call:
inputs:
ref:
description: Exact commit or ref to build.
type: string
required: false
default: ""
tag:
description: Published release tag to upload assets to (empty for validation).
type: string
required: false
default: ""
permissions:
contents: write
jobs:
licenses:
name: Check third-party notices
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.ref || inputs.tag || github.sha }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.98.0"
- uses: Swatinem/rust-cache@v2
- name: Install notice generator
uses: taiki-e/install-action@v2
with:
tool: cargo-about@0.9.2
- name: Verify notices
run: python3 scripts/generate-license-notices.py --check
- name: Reject tracked release artifacts
run: |
python3 - <<'PYTHON'
import subprocess
paths = subprocess.check_output(["git", "ls-files"], text=True).splitlines()
artifacts = [p for p in paths if p.lower().endswith((".exe", ".deb", ".rpm", ".appimage"))]
if artifacts:
raise SystemExit("Release artifacts must not be tracked: " + ", ".join(artifacts))
PYTHON
# Installers build while the notices are checked; only the upload waits for both.
linux:
name: Linux packages
# The oldest supported runner keeps the glibc requirement low.
runs-on: ubuntu-22.04
timeout-minutes: 60
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.ref || inputs.tag || github.sha }}
- name: Install native dependencies
run: |
sudo apt-get update
sudo apt-get install -y build-essential pkg-config clang cmake libssl-dev \
libfontconfig1-dev libfreetype6-dev libxkbcommon-dev libxkbcommon-x11-dev \
libwayland-dev libxcb1-dev libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libvulkan-dev dpkg-dev file
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.98.0"
- uses: Swatinem/rust-cache@v2
- name: Install packaging tools
uses: taiki-e/install-action@v2
with:
tool: cargo-deb,cargo-generate-rpm
- name: Install AppImage tool
run: |
mkdir -p "$HOME/.local/bin"
curl -fsSL -o "$HOME/.local/bin/appimagetool" \
https://github.com/AppImage/appimagetool/releases/download/continuous/appimagetool-x86_64.AppImage
chmod +x "$HOME/.local/bin/appimagetool"
echo "$HOME/.local/bin" >> "$GITHUB_PATH"
- name: Build packages
env:
APPIMAGE_EXTRACT_AND_RUN: "1"
run: scripts/package-linux.sh
- uses: actions/upload-artifact@v4
with:
name: linux-packages-${{ inputs.ref || inputs.tag || github.sha }}
path: target/packages/*
if-no-files-found: error
windows:
name: Windows installer
runs-on: windows-latest
timeout-minutes: 60
steps:
- uses: actions/checkout@v5
with:
ref: ${{ inputs.ref || inputs.tag || github.sha }}
- uses: dtolnay/rust-toolchain@stable
with:
toolchain: "1.98.0"
- uses: Swatinem/rust-cache@v2
- name: Check notice inputs
run: python3 scripts/generate-license-notices.py --check-inputs
- run: cargo build --release --locked -p nocterm
- name: Build installer
shell: pwsh
run: |
if (-not (Get-Command iscc -ErrorAction SilentlyContinue)) {
choco install innosetup -y --no-progress
$env:PATH += ";${env:ProgramFiles(x86)}\Inno Setup 6"
}
$version = (Get-Content version.txt -Raw).Trim()
iscc "/DAppVersion=$version" packaging\windows\nocterm.iss
- uses: actions/upload-artifact@v4
with:
name: windows-installer-${{ inputs.ref || inputs.tag || github.sha }}
path: target/packages/*.exe
if-no-files-found: error
upload:
name: Attach to release
if: inputs.tag != ''
needs: [licenses, linux, windows]
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- uses: actions/download-artifact@v4
with:
path: packages
pattern: '*-${{ inputs.tag }}'
merge-multiple: true
- name: Upload release assets
env:
GH_TOKEN: ${{ github.token }}
run: gh release upload "${{ inputs.tag }}" packages/* --clobber --repo "${{ github.repository }}"