discord/.forgejo/workflows/pipeline.yaml
2026-02-27 15:00:17 +01:00

88 lines
3.1 KiB
YAML

on:
release:
types: [published]
jobs:
upload:
runs-on: host
permissions:
packages: write
steps:
- uses: actions/setup-node@v6
with:
node-version: 24
- uses: actions/checkout@v6
with:
fetch-depth: 0
- name: Update version from tag
run: |
# Extract version from tag (e.g. v1.2.3 -> 1.2.3)
VERSION=${GITHUB_REF_NAME#v}
echo "Bumping version to $VERSION"
npm version $VERSION --no-git-tag-version
- run: npm ci
- run: npm run dist:linux
- name: Build Windows installer with 32-bit Wine prefix
run: |
export WINEARCH=win32
export WINEPREFIX="$HOME/.wine32"
wineboot -u
npm run dist:win
- name: Copy installers into static folder
run: |
mkdir -p static/installers
find static/installers -mindepth 1 -maxdepth 1 -type f -delete
copy_first() {
pattern="$1"
out="$2"
file="$(find dist -maxdepth 1 -type f -name "$pattern" | head -n 1)"
if [ -n "$file" ]; then
cp "$file" "static/installers/$out"
fi
}
# Copy versioned artifacts for electron-updater
cp dist/*.AppImage static/installers/ || true
cp dist/*.exe static/installers/ || true
cp dist/*.rpm static/installers/ || true
cp dist/*.deb static/installers/ || true
cp dist/*.msi static/installers/ || true
# Maintain generic names for stable website links
copy_first '*.rpm' 'chattz-linux.rpm'
copy_first '*.deb' 'chattz-linux.deb'
copy_first '*.AppImage' 'chattz-linux.AppImage'
copy_first '*.exe' 'chattz-windows.exe'
copy_first '*.msi' 'chattz-windows.msi'
# Metadata files for electron-updater
copy_first 'latest-linux.yml' 'latest-linux.yml'
copy_first 'latest.yml' 'latest.yml'
- name: Cache Cargo registry
uses: actions/cache@v4
with:
path: |
~/.cargo/bin/
~/.cargo/registry/index/
~/.cargo/registry/cache/
~/.cargo/git/db/
key: ${{ runner.os }}-cargo-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-
- name: Cache Cargo target
uses: actions/cache@v4
with:
path: target/
key: ${{ runner.os }}-cargo-target-${{ hashFiles('Cargo.lock') }}
restore-keys: |
${{ runner.os }}-cargo-target-
- run: ~/.cargo/bin/cargo build -r
- run: |
export XDG_RUNTIME_DIR=/run/user/$(id -u)
export DBUS_SESSION_BUS_ADDRESS=unix:path=/run/user/$(id -u)/bus
systemctl --user stop discord
mkdir -p ~/discord
cp target/release/chattz ~/discord/discord
chmod +x ~/discord/discord
mkdir -p ~/discord/static/uploads
find ~/discord/static -mindepth 1 -maxdepth 1 ! -name 'uploads' -exec rm -rf {} +
cp -r static/* ~/discord/static/
systemctl --user start discord