name: release # Push a tag like v0.2.0 to build Linux and Windows packages and attach them # to a Gitea release of that tag. on: push: tags: ["v*"] permissions: contents: write # One build at a time on the shared runner: a second run waits for the first. concurrency: group: gites-build cancel-in-progress: false jobs: release: runs-on: ubuntu-latest env: # AppImage tools need FUSE, which containers lack; this unpacks them instead. APPIMAGE_EXTRACT_AND_RUN: "1" # Fewer parallel compiles: the full set ran the runner's VPS out of memory. CARGO_BUILD_JOBS: "2" steps: - uses: actions/checkout@v4 # The same tool cache as in ci.yaml: the same key and the same folders, or # neither job can use what the other saved. - name: Restore tool cache uses: actions/cache@v4 with: path: | ~/.cargo/bin ~/.cargo/registry ~/.cargo/git ~/.rustup ~/.local/bin/mise ~/.local/share/mise key: tools-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} # After a change to mise.toml, start from the last tools; mise installs only what changed. restore-keys: | tools- # cargo-xwin, which takes minutes to compile, and the Windows SDK files it downloads. # The Windows Rust target is left out: rustup lists its installed parts in a file in # the tool cache, and refuses to install the target over files that list does not name. - name: Restore cargo-xwin cache uses: actions/cache@v4 with: path: | ~/.cargo/bin/cargo-xwin ~/.cache/cargo-xwin key: cargo-xwin-${{ hashFiles('scripts/ci-setup.sh', 'mise.toml') }} restore-keys: | cargo-xwin- - name: Restore build cache uses: actions/cache@v4 with: path: src-tauri/target key: target-release-${{ hashFiles('src-tauri/Cargo.lock') }}-${{ github.sha }} restore-keys: | target-release-${{ hashFiles('src-tauri/Cargo.lock') }}- target-release- - name: Install tools run: scripts/ci-setup.sh --windows - name: Take the version from the tag run: | node -e ' const fs = require("fs"); const p = "src-tauri/tauri.conf.json"; const c = JSON.parse(fs.readFileSync(p)); c.version = process.env.GITHUB_REF_NAME.replace(/^v/, ""); fs.writeFileSync(p, JSON.stringify(c, null, 2)); ' - name: Unit tests run: mise run test - name: Remove packages left in the build cache run: rm -rf src-tauri/target/release/bundle src-tauri/target/x86_64-pc-windows-msvc/release/bundle - name: Build Linux run: bun run tauri build --bundles deb,rpm,appimage - name: Build Windows run: bun run tauri build --runner cargo-xwin --target x86_64-pc-windows-msvc --bundles nsis - name: Collect files run: | mkdir -p release cp src-tauri/target/release/bundle/deb/*.deb release/ cp src-tauri/target/release/bundle/rpm/*.rpm release/ cp src-tauri/target/release/bundle/appimage/*.AppImage release/ cp src-tauri/target/x86_64-pc-windows-msvc/release/bundle/nsis/*.exe release/ cp src-tauri/target/x86_64-pc-windows-msvc/release/gites.exe "release/gites_${GITHUB_REF_NAME#v}_x64_portable.exe" ls -la release - name: Publish release env: GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }} run: scripts/publish-release.sh release/*