Merge pull request #6 from iTeebot/fix/snap-desktop #4
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: Production Release | |
| on: | |
| push: | |
| tags: | |
| - 'v*' | |
| workflow_dispatch: | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: true | |
| jobs: | |
| # --------------------------------------------------------------------------- | |
| # Web – Vercel production deploy | |
| # --------------------------------------------------------------------------- | |
| deploy-web-release: | |
| name: Deploy Release Web App to Vercel | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - name: Update Version Code | |
| shell: bash | |
| run: | | |
| if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$ ]]; then | |
| echo "Error: GITHUB_REF_NAME '$GITHUB_REF_NAME' is not a valid semver version tag." | |
| exit 1 | |
| fi | |
| VERSION=${GITHUB_REF_NAME#v} | |
| node scripts/update-version.cjs "$VERSION" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Install Vercel CLI | |
| run: pnpm add -g vercel | |
| - name: Pull Vercel Environment Information | |
| run: vercel pull --yes --environment=production --token=${{ secrets.VERCEL_TOKEN }} | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| - name: Build Project Artifacts | |
| run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| - name: Deploy Project Artifacts to Vercel | |
| run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }} | |
| env: | |
| VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
| VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
| # --------------------------------------------------------------------------- | |
| # Desktop – Windows, macOS, Linux (AppImage / deb / rpm) | |
| # tauri.conf.json has targets:"all" so every platform gets its native formats. | |
| # --------------------------------------------------------------------------- | |
| release-desktop: | |
| name: Build Desktop Release (${{ matrix.target }}) | |
| runs-on: ${{ matrix.platform }} | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| # macOS Apple Silicon | |
| - platform: 'macos-14' | |
| target: 'aarch64-apple-darwin' | |
| args: '--target aarch64-apple-darwin' | |
| # macOS Intel | |
| - platform: 'macos-14' | |
| target: 'x86_64-apple-darwin' | |
| args: '--target x86_64-apple-darwin' | |
| # Linux – AppImage, deb, rpm (all via targets:"all" in tauri.conf.json) | |
| - platform: 'ubuntu-22.04' | |
| target: 'x86_64-unknown-linux-gnu' | |
| args: '' | |
| # Windows – NSIS installer (nsis config in tauri.conf.json) | |
| - platform: 'windows-latest' | |
| target: 'x86_64-pc-windows-msvc' | |
| args: '' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| cache: 'pnpm' | |
| - name: Update Version Code | |
| shell: bash | |
| run: | | |
| if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+(-[a-zA-Z0-9.-]+)?$ ]]; then | |
| echo "Error: GITHUB_REF_NAME '$GITHUB_REF_NAME' is not a valid semver version tag." | |
| exit 1 | |
| fi | |
| VERSION=${GITHUB_REF_NAME#v} | |
| node scripts/update-version.cjs "$VERSION" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| cache: true | |
| target: ${{ matrix.target }} | |
| - name: Install system dependencies (Linux only) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| uses: ./.github/actions/install-dependencies | |
| - name: Build and Package Desktop App | |
| uses: tauri-apps/tauri-action@v0.6.2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tagName: ${{ github.ref_name }} | |
| releaseName: 'Teebot Flow v__VERSION__' | |
| releaseBody: 'Release v__VERSION__ of Teebot Flow.' | |
| releaseDraft: false | |
| prerelease: false | |
| args: ${{ matrix.args }} | |
| # --------------------------------------------------------------------------- | |
| # Linux Snap – separate job because snapcraft needs its own environment. | |
| # Ubuntu 22.04 runners ship snapd but the snap daemon is not socket-active | |
| # in the CI sandbox; snapcraft uses its own LXD / multipass build backend | |
| # which is why this runs on ubuntu-22.04 with snapcraft installed manually. | |
| # --------------------------------------------------------------------------- | |
| release-linux-snap: | |
| name: Build Desktop Release (Linux snap) | |
| runs-on: ubuntu-22.04 | |
| permissions: | |
| contents: write | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| persist-credentials: false | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: '.nvmrc' | |
| - name: Update Version Code | |
| shell: bash | |
| run: | | |
| if [[ ! "$GITHUB_REF_NAME" =~ ^v[0-9]+\.[0-9]+\.[0-9]+$ ]]; then | |
| echo "Error: GITHUB_REF_NAME '$GITHUB_REF_NAME' is not a stable vMAJOR.MINOR.PATCH tag. Skipping snap release." | |
| exit 1 | |
| fi | |
| VERSION=${GITHUB_REF_NAME#v} | |
| node scripts/update-version.cjs "$VERSION" | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Setup Rust toolchain | |
| uses: actions-rust-lang/setup-rust-toolchain@v1 | |
| with: | |
| cache: false | |
| - name: Install system dependencies (Linux) | |
| uses: ./.github/actions/install-dependencies | |
| - name: Install snapcraft | |
| run: sudo snap install snapcraft --classic | |
| - name: Setup LXD | |
| uses: canonical/setup-lxd@v1 | |
| - name: Grant user membership in lxd group | |
| run: sudo usermod -aG lxd "$USER" | |
| - name: Build Debian Package via Tauri | |
| run: pnpm tauri build --bundles deb | |
| - name: Stage deb for Snapcraft | |
| run: | | |
| mkdir -p build/extracted | |
| DEB_FILE=$(find src-tauri/target/release/bundle/deb -name "*.deb" | head -1) | |
| if [ -z "$DEB_FILE" ]; then | |
| echo "Error: no .deb file found after tauri build" | |
| exit 1 | |
| fi | |
| echo "Found deb: $DEB_FILE" | |
| echo "=== Deb contents ===" | |
| dpkg -c "$DEB_FILE" | |
| # Extract into build/extracted (snapcraft.yaml sources from here) | |
| dpkg -x "$DEB_FILE" build/extracted | |
| # Normalize the desktop file to the name snapcraft.yaml expects, | |
| # regardless of how Tauri named it (e.g. "Teebot Flow.desktop"). | |
| DESKTOP=$(find build/extracted/usr/share/applications -name "*.desktop" 2>/dev/null | head -1) | |
| if [ -z "$DESKTOP" ]; then | |
| echo "Error: no .desktop file found inside deb" | |
| exit 1 | |
| fi | |
| echo "Found desktop: $DESKTOP" | |
| if [ "$DESKTOP" != "build/extracted/usr/share/applications/teebot-flow.desktop" ]; then | |
| mv "$DESKTOP" build/extracted/usr/share/applications/teebot-flow.desktop | |
| echo "Renamed → build/extracted/usr/share/applications/teebot-flow.desktop" | |
| fi | |
| - name: Build Snap from Debian Package | |
| run: sg lxd -c "snapcraft pack --use-lxd" | |
| - name: Upload Snap to GitHub Release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| RELEASE_TAG: ${{ github.ref_name }} | |
| run: | | |
| SNAP_FILE=$(find . -maxdepth 1 -name "*.snap" | head -1) | |
| if [ -z "$SNAP_FILE" ]; then | |
| echo "Warning: no .snap file found, skipping GitHub Release upload" | |
| exit 0 | |
| fi | |
| echo "Uploading $SNAP_FILE to GitHub Release $RELEASE_TAG..." | |
| gh release upload "$RELEASE_TAG" "$SNAP_FILE" --clobber || \ | |
| echo "Release may not exist yet (created by desktop job). Snap will be uploaded by Snap Store step." | |
| - name: Publish Snap to Snap Store | |
| env: | |
| SNAPCRAFT_STORE_CREDENTIALS: ${{ secrets.SNAPCRAFT_STORE_CREDENTIALS }} | |
| run: | | |
| # snapcraft pack --use-lxd produces the .snap in the project root | |
| SNAP_FILE=$(find . -maxdepth 1 -name "*.snap" | head -1) | |
| if [ -z "$SNAP_FILE" ]; then | |
| echo "Error: no .snap file found after build" | |
| exit 1 | |
| fi | |
| echo "Uploading $SNAP_FILE to Snap Store (stable channel)..." | |
| snapcraft upload "$SNAP_FILE" --release=stable | |