Skip to content

Commit ca8de52

Browse files
committed
ci: publish tagged Debian packages
1 parent f82a6c5 commit ca8de52

4 files changed

Lines changed: 91 additions & 6 deletions

File tree

‎.github/workflows/build.yml‎

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,6 +66,8 @@ jobs:
6666
name: package Debian artifact
6767
runs-on: ubuntu-latest
6868
needs: kernel-4-15
69+
outputs:
70+
version: ${{ steps.version.outputs.version }}
6971
env:
7072
KERNEL_RELEASE: 4.15.0-60-generic
7173
KERNEL_ARCHITECTURE: i386
@@ -144,3 +146,73 @@ jobs:
144146
dist-pcct/*.deb
145147
dist-pcct/*.deb.sha256
146148
dist-pcct/install-usbdisplay-offline.sh
149+
150+
publish-tag:
151+
name: publish tagged Debian package
152+
if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/v')
153+
runs-on: ubuntu-latest
154+
needs: debian-package
155+
permissions:
156+
contents: write
157+
packages: write
158+
env:
159+
OCI_PACKAGE: ghcr.io/iotsharp/usbdisplaystack-deb
160+
PACKAGE_VERSION: ${{ needs.debian-package.outputs.version }}
161+
steps:
162+
- name: Download Debian package
163+
uses: actions/download-artifact@v4
164+
with:
165+
name: usbdisplay-stack-deb-${{ needs.debian-package.outputs.version }}
166+
path: dist-pcct
167+
168+
- name: Publish GitHub Release assets
169+
shell: bash
170+
env:
171+
GH_TOKEN: ${{ github.token }}
172+
run: |
173+
set -eu
174+
shopt -s nullglob
175+
assets=(
176+
dist-pcct/*.deb
177+
dist-pcct/*.deb.sha256
178+
dist-pcct/install-usbdisplay-offline.sh
179+
)
180+
if [ "${#assets[@]}" -ne 3 ]; then
181+
printf 'Expected three release assets, found %s\n' "${#assets[@]}" >&2
182+
exit 1
183+
fi
184+
if ! gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
185+
gh release create "$GITHUB_REF_NAME" \
186+
--verify-tag \
187+
--title "$GITHUB_REF_NAME" \
188+
--generate-notes
189+
fi
190+
gh release upload "$GITHUB_REF_NAME" "${assets[@]}" --clobber
191+
192+
- name: Install ORAS
193+
uses: oras-project/setup-oras@v1
194+
195+
- name: Publish Debian package to GitHub Packages
196+
shell: bash
197+
env:
198+
GHCR_TOKEN: ${{ github.token }}
199+
run: |
200+
set -eu
201+
package=$(find dist-pcct -maxdepth 1 -type f -name '*.deb' -print -quit)
202+
checksum="${package}.sha256"
203+
installer=dist-pcct/install-usbdisplay-offline.sh
204+
test -f "$package"
205+
test -f "$checksum"
206+
test -f "$installer"
207+
printf '%s' "$GHCR_TOKEN" | oras login ghcr.io \
208+
--username "$GITHUB_ACTOR" \
209+
--password-stdin
210+
oras push "$OCI_PACKAGE:$GITHUB_REF_NAME" \
211+
--artifact-type application/vnd.iotsharp.usbdisplaystack.debian.v1 \
212+
--annotation "org.opencontainers.image.source=https://github.com/$GITHUB_REPOSITORY" \
213+
--annotation "org.opencontainers.image.revision=$GITHUB_SHA" \
214+
--annotation "org.opencontainers.image.version=$PACKAGE_VERSION" \
215+
--annotation "org.opencontainers.image.title=USBDisplayStack Debian package" \
216+
"$package:application/vnd.debian.binary-package" \
217+
"$checksum:text/plain" \
218+
"$installer:application/vnd.iotsharp.usbdisplaystack.installer.v1+shell"

‎CHANGELOG.md‎

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22

33
## Unreleased
44

5+
- Publish tagged Debian artifacts to the matching GitHub Release and mirror
6+
them to GitHub Packages as a versioned GHCR OCI artifact.
57
- Render a redesigned connection-status splash with the project URL, support
68
QQ, and PCCT-injected package version while no fbdev or DRM producer is open,
79
and restore it when the last producer exits.

‎README.md‎

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@ stay in replaceable userspace backends.
1313
1414
## Quick install
1515

16-
The CI pipeline publishes one kernel-bound Debian package. Open
16+
The CI pipeline publishes one kernel-bound Debian package. For a tagged
17+
version, open [GitHub Releases](https://github.com/IoTSharp/USBDisplayStack/releases)
18+
and download its `.deb` asset. For a branch or manual CI build, open
1719
[GitHub Actions](https://github.com/IoTSharp/USBDisplayStack/actions), select a
1820
successful `build` run, download the `usbdisplay-stack-deb-<version>` artifact,
1921
and extract its `.deb` file.
@@ -211,8 +213,12 @@ pwsh ./scripts/build-pcct-deb.ps1 \
211213

212214
GitHub Actions runs the same PCCT packaging path on every push and pull request.
213215
It uploads the `.deb`, its SHA-256 sidecar, and the offline installer as a
214-
workflow artifact. A `vX.Y.Z` tag uses `X.Y.Z`; the manual workflow dispatch can
215-
override the version when a release artifact is needed.
216+
workflow artifact. A `vX.Y.Z` tag uses `X.Y.Z` and also publishes those files to
217+
the matching GitHub Release. The same tagged files are mirrored in GitHub
218+
Packages as the OCI artifact `ghcr.io/iotsharp/usbdisplaystack-deb:vX.Y.Z`;
219+
GitHub Packages does not provide a native Debian/APT package registry. The
220+
manual workflow dispatch can override the artifact version but does not publish
221+
a release or package.
216222

217223
The package contains its Debian lifecycle hooks and all project installation
218224
scripts. It deliberately does not activate the module or select the physical

‎README.zh-CN.md‎

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,9 @@ DRM/KMS 设备渲染;协议、压缩和 USB 传输由可替换的用户态后
1212
1313
## 快速安装
1414

15-
CI 会生成一个与目标内核绑定的 Debian 安装包。打开
15+
CI 会生成一个与目标内核绑定的 Debian 安装包。正式标签版本可直接打开
16+
[GitHub Releases](https://github.com/IoTSharp/USBDisplayStack/releases),下载对应
17+
版本的 `.deb` 资产。分支构建或手动 CI 构建则打开
1618
[GitHub Actions](https://github.com/IoTSharp/USBDisplayStack/actions),进入成功的
1719
`build` 任务,下载 `usbdisplay-stack-deb-<版本>` artifact,并解压其中的
1820
`.deb` 文件。
@@ -187,8 +189,11 @@ pwsh ./scripts/build-pcct-deb.ps1 \
187189
```
188190

189191
GitHub Actions 会在每次 push 和 pull request 时执行同一套 PCCT 打包流程,并上传
190-
`.deb`、SHA-256 校验文件和离线安装脚本作为 workflow artifact。推送 `vX.Y.Z` 标签
191-
时使用 `X.Y.Z` 作为包版本;也可以手动运行 workflow 并填写版本号。
192+
`.deb`、SHA-256 校验文件和离线安装脚本作为 workflow artifact。推送 `vX.Y.Z`
193+
标签时使用 `X.Y.Z` 作为包版本,并把这三个文件上传到同名 GitHub Release;同时
194+
以 OCI artifact `ghcr.io/iotsharp/usbdisplaystack-deb:vX.Y.Z` 镜像到 GitHub
195+
Packages。GitHub Packages 本身不提供原生 Debian/APT 软件源类型。手动运行
196+
workflow 可以填写 artifact 版本号,但不会发布 Release 或 Package。
192197

193198
DEB 已包含 Debian 生命周期脚本和项目的全部安装/卸载脚本。出于现场安全和
194199
replay 授权边界,安装后仍不会自动加载模块、选择实体后端或启动服务。离线安装、

0 commit comments

Comments
 (0)