Skip to content

Commit 5d97351

Browse files
committed
build: add release aliases and package publication workflows
1 parent 91a828d commit 5d97351

13 files changed

Lines changed: 365 additions & 2 deletions

.github/workflows/ci.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ jobs:
4747
-DCMAKE_BUILD_TYPE=Release \
4848
-DCMAKE_C_COMPILER=gcc-13 \
4949
-DCMAKE_CXX_COMPILER=g++-13 \
50+
-DENABLE_WARNINGS_ARE_ERRORS=ON \
5051
-DICEY_SOURCE_DIR=$GITHUB_WORKSPACE/icey
5152
5253
- name: Build
Lines changed: 177 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,177 @@
1+
name: Publish Package Managers
2+
3+
on:
4+
push:
5+
tags:
6+
- "v*"
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
jobs:
15+
build-manifests:
16+
runs-on: ubuntu-24.04
17+
outputs:
18+
cli_version: ${{ steps.versions.outputs.cli_version }}
19+
icey_version: ${{ steps.versions.outputs.icey_version }}
20+
steps:
21+
- uses: actions/checkout@v4
22+
23+
- name: Checkout icey
24+
uses: actions/checkout@v4
25+
with:
26+
repository: nilstate/icey
27+
path: icey
28+
29+
- name: Install dependencies
30+
run: |
31+
sudo apt-get update
32+
sudo apt-get install -y \
33+
gcc-13 g++-13 \
34+
cmake \
35+
dpkg-dev \
36+
libssl-dev \
37+
libavcodec-dev libavformat-dev libavutil-dev libswscale-dev libswresample-dev \
38+
unzip zip
39+
40+
- name: Setup Node
41+
uses: actions/setup-node@v4
42+
with:
43+
node-version: 22
44+
cache: npm
45+
cache-dependency-path: web/package-lock.json
46+
47+
- name: Read versions
48+
id: versions
49+
run: |
50+
echo "cli_version=$(tr -d '[:space:]' < VERSION)" >> "$GITHUB_OUTPUT"
51+
echo "icey_version=$(tr -d '[:space:]' < icey/VERSION)" >> "$GITHUB_OUTPUT"
52+
53+
- name: Build and render package managers
54+
env:
55+
CC: gcc-13
56+
CXX: g++-13
57+
ICEY_SOURCE_DIR: ${{ github.workspace }}/icey
58+
BUILD_DIR: ${{ github.workspace }}/build-release
59+
APT_BASE_URL: https://nilstate.github.io/icey-cli/apt
60+
run: ./scripts/package-manager-check.sh
61+
62+
- name: Prepare Pages artifact
63+
run: |
64+
rm -rf .stage/pages
65+
mkdir -p .stage/pages/apt
66+
cp -R .stage/apt-repo/. .stage/pages/apt/
67+
cat > .stage/pages/index.html <<'EOF'
68+
<!doctype html>
69+
<html lang="en">
70+
<head>
71+
<meta charset="utf-8">
72+
<title>icey package repositories</title>
73+
</head>
74+
<body>
75+
<p>APT repository: <a href="./apt/">./apt/</a></p>
76+
</body>
77+
</html>
78+
EOF
79+
80+
- uses: actions/upload-artifact@v4
81+
with:
82+
name: package-managers-rendered
83+
path: .stage/package-managers/rendered
84+
85+
- uses: actions/configure-pages@v5
86+
87+
- uses: actions/upload-pages-artifact@v3
88+
with:
89+
path: .stage/pages
90+
91+
deploy-apt-pages:
92+
runs-on: ubuntu-24.04
93+
needs: build-manifests
94+
environment:
95+
name: github-pages
96+
url: ${{ steps.deployment.outputs.page_url }}
97+
steps:
98+
- id: deployment
99+
uses: actions/deploy-pages@v4
100+
101+
publish-homebrew:
102+
runs-on: ubuntu-24.04
103+
needs: build-manifests
104+
if: ${{ secrets.HOMEBREW_TAP_TOKEN != '' }}
105+
steps:
106+
- uses: actions/checkout@v4
107+
108+
- uses: actions/download-artifact@v4
109+
with:
110+
name: package-managers-rendered
111+
path: .stage/package-managers/rendered
112+
113+
- name: Checkout tap repo
114+
uses: actions/checkout@v4
115+
with:
116+
repository: nilstate/homebrew-tap
117+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
118+
path: .stage/homebrew-tap
119+
120+
- name: Publish formula
121+
env:
122+
TAP_REPO_DIR: ${{ github.workspace }}/.stage/homebrew-tap
123+
run: ./scripts/publish-homebrew.sh
124+
125+
- name: Commit formula update
126+
run: |
127+
git -C .stage/homebrew-tap config user.name "github-actions[bot]"
128+
git -C .stage/homebrew-tap config user.email "41898282+github-actions[bot]@users.noreply.github.com"
129+
if git -C .stage/homebrew-tap diff --quiet; then
130+
exit 0
131+
fi
132+
git -C .stage/homebrew-tap add Formula/icey-server.rb
133+
git -C .stage/homebrew-tap commit -m "icey-server ${{ needs.build-manifests.outputs.cli_version }}"
134+
git -C .stage/homebrew-tap push
135+
136+
publish-aur:
137+
runs-on: ubuntu-24.04
138+
needs: build-manifests
139+
if: ${{ secrets.AUR_SSH_PRIVATE_KEY != '' }}
140+
steps:
141+
- uses: actions/checkout@v4
142+
143+
- uses: actions/download-artifact@v4
144+
with:
145+
name: package-managers-rendered
146+
path: .stage/package-managers/rendered
147+
148+
- name: Configure SSH
149+
run: |
150+
install -m 700 -d ~/.ssh
151+
printf '%s\n' "${AUR_SSH_PRIVATE_KEY}" > ~/.ssh/aur
152+
chmod 600 ~/.ssh/aur
153+
ssh-keyscan aur.archlinux.org >> ~/.ssh/known_hosts
154+
env:
155+
AUR_SSH_PRIVATE_KEY: ${{ secrets.AUR_SSH_PRIVATE_KEY }}
156+
157+
- name: Checkout AUR package
158+
run: git clone ssh://aur@aur.archlinux.org/icey-server.git .stage/aur-repo
159+
env:
160+
GIT_SSH_COMMAND: ssh -i ~/.ssh/aur -o IdentitiesOnly=yes
161+
162+
- name: Publish AUR package
163+
env:
164+
AUR_REPO_DIR: ${{ github.workspace }}/.stage/aur-repo
165+
run: ./scripts/publish-aur.sh
166+
167+
- name: Commit AUR update
168+
run: |
169+
git -C .stage/aur-repo config user.name "github-actions[bot]"
170+
git -C .stage/aur-repo config user.email "41898282+github-actions[bot]@users.noreply.github.com"
171+
if git -C .stage/aur-repo diff --quiet; then
172+
exit 0
173+
fi
174+
git -C .stage/aur-repo add PKGBUILD .SRCINFO
175+
git -C .stage/aur-repo commit -m "icey-server ${{ needs.build-manifests.outputs.cli_version }}"
176+
GIT_SSH_COMMAND='ssh -i ~/.ssh/aur -o IdentitiesOnly=yes' \
177+
git -C .stage/aur-repo push

.github/workflows/release.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -55,6 +55,8 @@ jobs:
5555
icey-*-source.tar.gz
5656
icey-server-*-Linux-x86_64.tar.gz
5757
icey-server-*-Linux-x86_64.zip
58+
icey-server-Linux-x86_64.tar.gz
59+
icey-server-Linux-x86_64.zip
5860
icey-server_*.deb
5961
icey-server-apt-repo-*.tar.gz
6062

Makefile

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
.PHONY: configure build install package package-deb package-apt package-managers \
2-
web-install web-build smoke-stream release-check docker-build
2+
publish-homebrew publish-aur publish-apt-site web-install web-build \
3+
smoke-stream release-check docker-build
34

45
ICEY_SOURCE_DIR ?= ../icey
56
BUILD_DIR ?= build-dev
@@ -27,6 +28,15 @@ package-apt:
2728
package-managers:
2829
ICEY_SOURCE_DIR=$(ICEY_SOURCE_DIR) BUILD_DIR=$(BUILD_DIR) ./scripts/package-manager-check.sh
2930

31+
publish-homebrew:
32+
./scripts/publish-homebrew.sh
33+
34+
publish-aur:
35+
./scripts/publish-aur.sh
36+
37+
publish-apt-site:
38+
./scripts/publish-apt-site.sh
39+
3040
web-install:
3141
$(NPM) ci
3242

flake.nix

Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
{
2+
description = "icey-server packaged as a Nix flake";
3+
4+
inputs = {
5+
nixpkgs.url = "github:NixOS/nixpkgs/nixos-unstable";
6+
flake-utils.url = "github:numtide/flake-utils";
7+
icey = {
8+
url = "github:nilstate/icey";
9+
flake = false;
10+
};
11+
};
12+
13+
outputs = { self, nixpkgs, flake-utils, icey }:
14+
flake-utils.lib.eachDefaultSystem (system:
15+
let
16+
pkgs = import nixpkgs { inherit system; };
17+
version = builtins.replaceStrings ["\n" "\r"] ["" ""] (builtins.readFile ./VERSION);
18+
in {
19+
packages.default = pkgs.stdenv.mkDerivation {
20+
pname = "icey-server";
21+
inherit version;
22+
src = self;
23+
24+
nativeBuildInputs = with pkgs; [
25+
cmake
26+
nodejs
27+
pkg-config
28+
];
29+
30+
buildInputs = with pkgs; [
31+
ffmpeg
32+
openssl
33+
];
34+
35+
buildPhase = ''
36+
runHook preBuild
37+
npm --prefix web ci
38+
npm --prefix web run build
39+
cmake -S . -B build \
40+
-DCMAKE_BUILD_TYPE=Release \
41+
-DICEY_SOURCE_DIR=${icey}
42+
cmake --build build -j1 --target icey-server
43+
runHook postBuild
44+
'';
45+
46+
installPhase = ''
47+
runHook preInstall
48+
cmake --install build --prefix $out --component apps
49+
runHook postInstall
50+
'';
51+
52+
meta = with pkgs.lib; {
53+
description = "Self-hosted source-to-browser server built on icey";
54+
homepage = "https://github.com/nilstate/icey-cli";
55+
license = licenses.agpl3Plus;
56+
platforms = platforms.linux ++ platforms.darwin;
57+
mainProgram = "icey-server";
58+
};
59+
};
60+
61+
apps.default = flake-utils.lib.mkApp {
62+
drv = self.packages.${system}.default;
63+
exePath = "/bin/icey-server";
64+
};
65+
});
66+
}

scripts/package-manager-check.sh

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ ICEY_VERSION="$(tr -d '[:space:]' < "$ICEY_SOURCE_DIR/VERSION")"
99
LINUX_BASENAME="icey-server-${CLI_VERSION}-Linux-x86_64"
1010
LINUX_TARBALL="$ROOT_DIR/${LINUX_BASENAME}.tar.gz"
1111
LINUX_ZIP="$ROOT_DIR/${LINUX_BASENAME}.zip"
12+
LATEST_LINUX_TARBALL="$ROOT_DIR/icey-server-Linux-x86_64.tar.gz"
13+
LATEST_LINUX_ZIP="$ROOT_DIR/icey-server-Linux-x86_64.zip"
1214
CLI_SOURCE_ARCHIVE="$ROOT_DIR/icey-cli-${CLI_VERSION}-source.tar.gz"
1315
ICEY_SOURCE_ARCHIVE="$ROOT_DIR/icey-${ICEY_VERSION}-source.tar.gz"
1416
DEB_PATH="$ROOT_DIR/icey-server_${CLI_VERSION}_amd64.deb"
@@ -26,6 +28,8 @@ ICEY_SOURCE_DIR="$ICEY_SOURCE_DIR" \
2628

2729
tar -tzf "$LINUX_TARBALL" >/dev/null
2830
unzip -Z1 "$LINUX_ZIP" >/dev/null
31+
tar -tzf "$LATEST_LINUX_TARBALL" >/dev/null
32+
unzip -Z1 "$LATEST_LINUX_ZIP" >/dev/null
2933
dpkg-deb --contents "$DEB_PATH" >/dev/null
3034
tar -tzf "$APT_REPO_ARCHIVE" >/dev/null
3135

@@ -37,5 +41,6 @@ test -f "$RENDERED_DIR/scoop/icey-server.json"
3741
test -f "$RENDERED_DIR/chocolatey/icey-server.nuspec"
3842
test -f "$RENDERED_DIR/winget/0state.IceyServer.installer.yaml"
3943
test -f "$RENDERED_DIR/SHA256SUMS.txt"
44+
test -f "$ROOT_DIR/flake.nix"
4045

4146
echo "Package manager cutover artifacts validated."

scripts/package-release.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,8 @@ STAGE_ROOT="${STAGE_ROOT:-$ROOT_DIR/.stage/package-release}"
1010
PACKAGE_ROOT="$STAGE_ROOT/$PACKAGE_NAME"
1111
PACKAGE_PATH="$ROOT_DIR/${PACKAGE_NAME}.tar.gz"
1212
ZIP_PATH="$ROOT_DIR/${PACKAGE_NAME}.zip"
13+
LATEST_PACKAGE_PATH="$ROOT_DIR/icey-server-$(uname -s)-$(uname -m).tar.gz"
14+
LATEST_ZIP_PATH="$ROOT_DIR/icey-server-$(uname -s)-$(uname -m).zip"
1315

1416
if [[ ! -f "$ICEY_SOURCE_DIR/CMakeLists.txt" ]]; then
1517
echo "ICEY_SOURCE_DIR does not point to an icey source tree: $ICEY_SOURCE_DIR" >&2
@@ -46,6 +48,10 @@ rm -f "$ZIP_PATH"
4648
cd "$STAGE_ROOT"
4749
zip -qr "$ZIP_PATH" "$PACKAGE_NAME"
4850
)
51+
cp "$PACKAGE_PATH" "$LATEST_PACKAGE_PATH"
52+
cp "$ZIP_PATH" "$LATEST_ZIP_PATH"
4953

5054
echo "Created package: $PACKAGE_PATH"
5155
echo "Created package: $ZIP_PATH"
56+
echo "Created stable alias: $LATEST_PACKAGE_PATH"
57+
echo "Created stable alias: $LATEST_ZIP_PATH"

scripts/publish-apt-site.sh

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
APT_REPO_ROOT="${APT_REPO_ROOT:-$ROOT_DIR/.stage/apt-repo}"
6+
SITE_ROOT="${SITE_ROOT:?Set SITE_ROOT to the document root for the published package site}"
7+
DEST_DIR="$SITE_ROOT/apt"
8+
9+
if [[ ! -d "$APT_REPO_ROOT/dists" ]]; then
10+
echo "APT repository root missing or incomplete: $APT_REPO_ROOT" >&2
11+
exit 1
12+
fi
13+
14+
rm -rf "$DEST_DIR"
15+
mkdir -p "$DEST_DIR"
16+
cp -R "$APT_REPO_ROOT"/. "$DEST_DIR/"
17+
18+
cat > "$SITE_ROOT/index.html" <<'EOF'
19+
<!doctype html>
20+
<html lang="en">
21+
<head>
22+
<meta charset="utf-8">
23+
<title>icey package repositories</title>
24+
</head>
25+
<body>
26+
<p>APT repository: <a href="./apt/">./apt/</a></p>
27+
</body>
28+
</html>
29+
EOF
30+
31+
echo "Published APT site to $SITE_ROOT"

scripts/publish-aur.sh

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
RENDERED_DIR="${RENDERED_DIR:-$ROOT_DIR/.stage/package-managers/rendered}"
6+
AUR_REPO_DIR="${AUR_REPO_DIR:?Set AUR_REPO_DIR to a checked-out AUR package repository}"
7+
8+
for file in PKGBUILD .SRCINFO; do
9+
if [[ ! -f "$RENDERED_DIR/aur/$file" ]]; then
10+
echo "Rendered AUR file missing: $RENDERED_DIR/aur/$file" >&2
11+
exit 1
12+
fi
13+
cp "$RENDERED_DIR/aur/$file" "$AUR_REPO_DIR/$file"
14+
done
15+
16+
echo "Published AUR package files to $AUR_REPO_DIR"

scripts/publish-homebrew.sh

Lines changed: 17 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,17 @@
1+
#!/usr/bin/env bash
2+
set -euo pipefail
3+
4+
ROOT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
5+
RENDERED_DIR="${RENDERED_DIR:-$ROOT_DIR/.stage/package-managers/rendered}"
6+
TAP_REPO_DIR="${TAP_REPO_DIR:?Set TAP_REPO_DIR to a checked-out Homebrew tap repository}"
7+
FORMULA_SRC="$RENDERED_DIR/homebrew/icey-server.rb"
8+
FORMULA_DST="$TAP_REPO_DIR/Formula/icey-server.rb"
9+
10+
if [[ ! -f "$FORMULA_SRC" ]]; then
11+
echo "Rendered Homebrew formula missing: $FORMULA_SRC" >&2
12+
exit 1
13+
fi
14+
15+
mkdir -p "$(dirname "$FORMULA_DST")"
16+
cp "$FORMULA_SRC" "$FORMULA_DST"
17+
echo "Published Homebrew formula to $FORMULA_DST"

0 commit comments

Comments
 (0)