Repository navigation
191 lines (183 loc) · 8.73 KB
/
Copy pathplugin-release.yml
File metadata and controls
191 lines (183 loc) · 8.73 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
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
# Builds the CLAP + VST3 plugin bundles and attaches them to an existing GitHub
# release.
#
# TRIGGER: this waits for cargo-dist's `Release` workflow to finish, because the
# release object must exist before anything can be uploaded to it.
#
# It does NOT trigger on `release: published`, even though that reads like the
# obvious choice. GitHub refuses to start workflows from events created with the
# default GITHUB_TOKEN (a deliberate guard against recursive runs), and dist's
# `host` job creates the release with exactly that token — so a `release:
# published` trigger never fires at all. v0.3.0 shipped with no plugin bundles
# because of this and had to be dispatched by hand.
#
# Triggering on tag push instead would race dist and 404 on every upload, since
# the release does not exist for the ~8 minutes dist spends building. workflow_run
# avoids both problems: it fires on completion, and `head_branch` carries the tag.
#
# Do not fold this into `.github/workflows/release.yml` — that file is generated
# by `dist init` and hand edits are destroyed on regeneration.
name: Plugin Release
on:
workflow_run:
workflows: ["Release"]
types: [completed]
workflow_dispatch:
inputs:
tag:
description: "Existing release tag to build and upload plugin bundles for"
required: true
type: string
permissions:
contents: write
env:
# For workflow_run, `head_branch` is the ref that started the upstream run —
# the tag name for a tag push. Unset for workflow_dispatch, which passes `tag`.
RELEASE_TAG: ${{ github.event.workflow_run.head_branch || inputs.tag }}
jobs:
bundle:
name: Bundle plugin (${{ matrix.label }})
# `Release` also runs on pull_request, and those completions raise
# workflow_run too. Only act on a successful run that came from a tag push.
if: >-
github.event_name == 'workflow_dispatch' ||
(github.event.workflow_run.conclusion == 'success' &&
github.event.workflow_run.event == 'push' &&
startsWith(github.event.workflow_run.head_branch, 'v'))
runs-on: ${{ matrix.runner }}
strategy:
fail-fast: false
matrix:
include:
# Native runners on purpose — cross-compiling the iced_baseview GUI
# needs a full target sysroot for X11/xcb/GL/xkbcommon. Building on
# each target's own runner sidesteps that entirely. This matrix
# mirrors the `plugin` job in ci.yaml; keep them in sync.
- label: linux-x86_64
runner: ubuntu-latest
arch_dir: x86_64-linux
vst3_lib: Rustortion.so
asset: Rustortion-linux-x86_64.zip
- label: linux-aarch64
# Free for public repositories. Native arm64, no sysroot needed.
runner: ubuntu-24.04-arm
arch_dir: aarch64-linux
vst3_lib: Rustortion.so
asset: Rustortion-linux-aarch64.zip
- label: windows-x86_64
runner: windows-latest
arch_dir: x86_64-win
# On Windows the VST3 payload is a DLL that keeps the .vst3
# extension, not a .so — see nih_plug_xtask's
# `vst3_bundle_library_name`.
vst3_lib: Rustortion.vst3
asset: Rustortion-windows-x86_64.zip
steps:
- uses: actions/checkout@v7
with:
# Build exactly the code the release was cut from, not branch tip.
ref: ${{ env.RELEASE_TAG }}
# X11/GL headers for the plugin GUI. Windows needs no equivalent — wgpu
# goes through DX12 and the window backend is win32.
- name: Install system dependencies
if: runner.os == 'Linux'
run: |
sudo apt-get update && sudo apt-get install -y \
libjack-jackd2-dev libasound2-dev pkg-config \
libgl-dev libx11-dev libx11-xcb-dev libxcb1-dev \
libxcursor-dev libxfixes-dev libxft-dev libxi-dev \
libxinerama-dev libxmu-dev libxrandr-dev libxrender-dev \
libxss-dev libxt-dev libxtst-dev libxxf86vm-dev \
libxkbcommon-dev libxkbcommon-x11-dev libxpresent-dev \
libxcb-render0-dev libxcb-shape0-dev libxcb-xfixes0-dev \
libxcb-icccm4-dev libxcb-dri2-0-dev zip
- name: Set up Rust
uses: dtolnay/rust-toolchain@stable
# No rust-cache here on purpose: release builds should not inherit a warm,
# possibly polluted target/ directory.
- name: Clean stale bundle output
shell: bash
run: rm -rf target/bundled
- name: Bundle plugin
# `--profile dist` matches cargo-dist's release profile (lto = true,
# codegen-units = 1) so the plugin gets the same optimisation level as
# the standalone binary in the same release.
run: cargo xtask bundle rustortion-plugin --profile dist --locked
- name: Verify bundle structure
shell: bash
run: |
set -euo pipefail
test -f target/bundled/Rustortion.clap
test -f "target/bundled/Rustortion.vst3/Contents/${{ matrix.arch_dir }}/${{ matrix.vst3_lib }}"
unexpected="$(find target/bundled/Rustortion.vst3/Contents \
-mindepth 1 -maxdepth 1 -not -name '${{ matrix.arch_dir }}' -print)"
if [ -n "$unexpected" ]; then
echo "Unexpected entries in the VST3 bundle:"
echo "$unexpected"
exit 1
fi
find target/bundled
# `zip -y` keeps symlinks as symlinks. Windows has no `zip` binary, so it
# uses Compress-Archive instead — the Windows bundle has no symlinks to
# preserve, so the two produce equivalent archives.
- name: Package (Linux)
if: runner.os == 'Linux'
shell: bash
run: |
set -euo pipefail
zip -r -y "$GITHUB_WORKSPACE/${{ matrix.asset }}" \
Rustortion.clap Rustortion.vst3
working-directory: target/bundled
- name: Package (Windows)
if: runner.os == 'Windows'
shell: pwsh
run: |
Compress-Archive -Path Rustortion.clap, Rustortion.vst3 `
-DestinationPath "$env:GITHUB_WORKSPACE\${{ matrix.asset }}"
working-directory: target/bundled
# shell: bash is load-bearing on Windows. The default shell there is pwsh,
# which does not expand `$RELEASE_TAG` — it silently becomes an empty
# string and `gh release upload ""` fails with "release not found".
- name: Upload to release
shell: bash
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: gh release upload "$RELEASE_TAG" "${{ matrix.asset }}" --clobber
# dist writes the release body and only knows about what it built, so its
# download table lists the standalone alone. Without this the plugin zips are
# present in Assets but nothing in the notes points at them, which reads as
# "this release is standalone-only".
notes:
name: Add the plugin downloads to the release notes
needs: bundle
runs-on: ubuntu-latest
steps:
- name: Append plugin download table
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# This job has no actions/checkout, so gh cannot infer the repo from a
# git remote — without GH_REPO it fails with "not a git repository".
# Setting it is cheaper than checking out the tree just to name a repo.
GH_REPO: ${{ github.repository }}
run: |
set -euo pipefail
body="$(gh release view "$RELEASE_TAG" --json body --jq '.body')"
# Idempotent: re-dispatching this workflow must not stack up tables.
if printf '%s' "$body" | grep -qF '<!-- plugin-bundles -->'; then
echo "Plugin download table already present; leaving the notes alone."
exit 0
fi
base="https://github.com/$GITHUB_REPOSITORY/releases/download/$RELEASE_TAG"
{
printf '%s\n\n' "$body"
printf '<!-- plugin-bundles -->\n'
printf '## Download the VST3/CLAP plugin %s\n\n' "${RELEASE_TAG#v}"
printf '| File | Platform | Status |\n'
printf '|--------|----------|--------|\n'
printf '| [Rustortion-linux-x86_64.zip](%s/Rustortion-linux-x86_64.zip) | x64 Linux | Tested in a DAW |\n' "$base"
printf '| [Rustortion-linux-aarch64.zip](%s/Rustortion-linux-aarch64.zip) | ARM64 Linux | Built in CI, not hand-tested |\n' "$base"
printf '| [Rustortion-windows-x86_64.zip](%s/Rustortion-windows-x86_64.zip) | x64 Windows | Built in CI, not hand-tested |\n' "$base"
printf '\nEach archive contains both `Rustortion.clap` and `Rustortion.vst3`. '
printf 'See the [README](https://github.com/%s#vst3clap-plugin) for install paths.\n' "$GITHUB_REPOSITORY"
} > release-notes.md
gh release edit "$RELEASE_TAG" --notes-file release-notes.md