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 - name: Install packaging deps (Linux + Windows cross-build) run: sudo apt-get update && sudo apt-get install -y rpm wine64 nsis - run: npm ci - run: npm run dist:linux - run: 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_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' - 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