CI: disable release auto publishing, fix linux build #2
Workflow file for this run
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| inputs: | |
| tag: | |
| description: 'Existing tag to (re)build (e.g. v2.0.0-beta.4)' | |
| required: true | |
| type: string | |
| permissions: | |
| contents: write | |
| concurrency: | |
| group: release-${{ github.event.inputs.tag || github.ref_name }} | |
| cancel-in-progress: false | |
| jobs: | |
| prepare: | |
| name: Prepare release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag: ${{ steps.context.outputs.tag }} | |
| version: ${{ steps.context.outputs.version }} | |
| is_prerelease: ${{ steps.context.outputs.is_prerelease }} | |
| steps: | |
| - name: Resolve tag and version | |
| id: context | |
| shell: bash | |
| run: | | |
| tag="${{ github.event.inputs.tag || github.ref_name }}" | |
| if [[ "$tag" != v* ]]; then | |
| echo "::error::Tag '$tag' must start with 'v'" | |
| exit 1 | |
| fi | |
| version="${tag#v}" | |
| if [[ "$version" == *-* ]]; then | |
| is_prerelease=true | |
| else | |
| is_prerelease=false | |
| fi | |
| echo "tag=$tag" >> "$GITHUB_OUTPUT" | |
| echo "version=$version" >> "$GITHUB_OUTPUT" | |
| echo "is_prerelease=$is_prerelease" >> "$GITHUB_OUTPUT" | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.context.outputs.tag }} | |
| - name: Verify package.json version matches tag | |
| shell: bash | |
| env: | |
| EXPECTED: ${{ steps.context.outputs.version }} | |
| run: | | |
| actual=$(node -p "require('./package.json').version") | |
| if [[ "$actual" != "$EXPECTED" ]]; then | |
| echo "::error::package.json version ($actual) does not match tag version ($EXPECTED)" | |
| exit 1 | |
| fi | |
| - name: Ensure draft release exists | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ steps.context.outputs.tag }} | |
| VERSION: ${{ steps.context.outputs.version }} | |
| IS_PRERELEASE: ${{ steps.context.outputs.is_prerelease }} | |
| shell: bash | |
| run: | | |
| if ! gh release view "$TAG" >/dev/null 2>&1; then | |
| flags=(--draft) | |
| if [[ "$IS_PRERELEASE" == "true" ]]; then | |
| flags+=(--prerelease) | |
| fi | |
| gh release create "$TAG" \ | |
| --title "Sigma File Manager v$VERSION" \ | |
| --generate-notes \ | |
| "${flags[@]}" | |
| else | |
| echo "Release $TAG already exists; assets will be added/replaced." | |
| fi | |
| build: | |
| name: Build (${{ matrix.platform }}) | |
| needs: prepare | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: windows | |
| os: windows-latest | |
| - platform: linux | |
| os: ubuntu-22.04 | |
| runs-on: ${{ matrix.os }} | |
| env: | |
| RUSTC_WRAPPER: sccache | |
| SCCACHE_GHA_ENABLED: "true" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ needs.prepare.outputs.tag }} | |
| - name: Setup Volta | |
| uses: volta-cli/action@v4 | |
| - name: Rust toolchain | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Setup sccache | |
| uses: mozilla-actions/sccache-action@v0.0.9 | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| prefix-key: v1-rust | |
| shared-key: release-${{ matrix.platform }} | |
| workspaces: src-tauri | |
| cache-on-failure: true | |
| - name: Resolve npm cache directory | |
| id: npm-cache-dir | |
| shell: bash | |
| run: echo "dir=$(npm config get cache)" >> "$GITHUB_OUTPUT" | |
| - name: Cache npm | |
| uses: actions/cache@v4 | |
| with: | |
| path: ${{ steps.npm-cache-dir.outputs.dir }} | |
| key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
| restore-keys: | | |
| ${{ runner.os }}-node- | |
| - name: Install Linux dependencies | |
| if: matrix.platform == 'linux' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libwebkit2gtk-4.1-dev \ | |
| libayatana-appindicator3-dev \ | |
| librsvg2-dev \ | |
| patchelf | |
| - name: Install npm dependencies | |
| run: npm ci | |
| - name: Sync Cargo version with package.json | |
| run: npm run sync-version | |
| - name: Build Tauri bundles | |
| env: | |
| NO_STRIP: ${{ matrix.platform == 'linux' && 'true' || '' }} | |
| PLATFORM: ${{ matrix.platform }} | |
| shell: bash | |
| run: | | |
| if [[ "$PLATFORM" == "linux" ]]; then | |
| npm run tauri:build:linux | |
| else | |
| npm run tauri:build | |
| fi | |
| - name: Upload Tauri bundles | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ needs.prepare.outputs.tag }} | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| PLATFORM: ${{ matrix.platform }} | |
| shell: bash | |
| run: | | |
| mkdir -p staged | |
| shopt -s nullglob | |
| if [[ "$PLATFORM" == "windows" ]]; then | |
| bundles=(src-tauri/target/release/bundle/nsis/*.exe) | |
| else | |
| bundles=( | |
| src-tauri/target/release/bundle/appimage/*.AppImage | |
| src-tauri/target/release/bundle/deb/*.deb | |
| ) | |
| fi | |
| if (( ${#bundles[@]} == 0 )); then | |
| echo "::error::No Tauri bundles found for $PLATFORM" | |
| exit 1 | |
| fi | |
| for bundle in "${bundles[@]}"; do | |
| case "$bundle" in | |
| *.AppImage) | |
| staged_asset="staged/Sigma-File-Manager-${VERSION}-linux.AppImage" | |
| ;; | |
| *.deb) | |
| staged_asset="staged/Sigma-File-Manager-${VERSION}-linux.deb" | |
| ;; | |
| *.exe) | |
| staged_asset="staged/Sigma-File-Manager-${VERSION}-windows-setup.exe" | |
| ;; | |
| *) | |
| extension="${bundle##*.}" | |
| staged_asset="staged/Sigma-File-Manager-${VERSION}-${PLATFORM}.${extension}" | |
| ;; | |
| esac | |
| cp "$bundle" "$staged_asset" | |
| gh release upload "$TAG" "$staged_asset" --clobber | |
| done | |
| - name: Upload Linux binary | |
| if: matrix.platform == 'linux' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ needs.prepare.outputs.tag }} | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| shell: bash | |
| run: | | |
| binary="src-tauri/target/release/sigma-file-manager" | |
| if [[ ! -f "$binary" ]]; then | |
| echo "::error::Linux binary not found at $binary" | |
| exit 1 | |
| fi | |
| chmod +x "$binary" | |
| mkdir -p staged | |
| staged_binary="staged/Sigma-File-Manager-${VERSION}-linux-binary" | |
| cp "$binary" "$staged_binary" | |
| gh release upload "$TAG" "$staged_binary" --clobber | |
| - name: Install Flatpak toolchain | |
| if: matrix.platform == 'linux' | |
| run: | | |
| sudo apt-get install -y flatpak flatpak-builder | |
| flatpak remote-add --if-not-exists --user flathub https://flathub.org/repo/flathub.flatpakrepo | |
| flatpak install -y --noninteractive --user flathub org.gnome.Platform//48 org.gnome.Sdk//48 | |
| - name: Build Flatpak bundle | |
| if: matrix.platform == 'linux' | |
| run: bash flatpak/build-flatpak.sh | |
| - name: Upload Flatpak bundle | |
| if: matrix.platform == 'linux' | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG: ${{ needs.prepare.outputs.tag }} | |
| VERSION: ${{ needs.prepare.outputs.version }} | |
| shell: bash | |
| run: | | |
| flatpak_bundle="flatpak/output/Sigma-File-Manager-${VERSION}-linux.flatpak" | |
| if [[ ! -f "$flatpak_bundle" ]]; then | |
| echo "::error::Flatpak bundle not found at $flatpak_bundle" | |
| exit 1 | |
| fi | |
| gh release upload "$TAG" "$flatpak_bundle" --clobber |