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 Build and Publish | |
| on: | |
| push: | |
| tags: | |
| - "v*" | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: "Release version (e.g., v0.5.0)" | |
| required: true | |
| permissions: | |
| contents: write | |
| jobs: | |
| build-release: | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: "macos-latest" | |
| args: "--target universal-apple-darwin" | |
| rust-target: "universal-apple-darwin" | |
| sidecar-target: "universal-apple-darwin" | |
| - platform: "ubuntu-22.04" | |
| args: "" | |
| rust-target: "x86_64-unknown-linux-gnu" | |
| sidecar-target: "x86_64-unknown-linux-gnu" | |
| runs-on: ${{ matrix.platform }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "20" | |
| cache: "npm" | |
| cache-dependency-path: frontend/package-lock.json | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.rust-target }} | |
| - name: Install dependencies (Ubuntu) | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev \ | |
| build-essential \ | |
| curl \ | |
| wget \ | |
| file \ | |
| libxdo-dev \ | |
| libssl-dev \ | |
| libayatana-appindicator3-dev \ | |
| librsvg2-dev | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "./backend -> target" | |
| - name: Install frontend dependencies | |
| working-directory: frontend | |
| run: npm ci | |
| - name: Build backend (linggen-server) | |
| working-directory: backend | |
| run: cargo build --release --bin linggen-server | |
| - name: Build CLI (linggen) | |
| working-directory: linggen-cli | |
| run: cargo build --release | |
| - name: Package CLI and server tarballs | |
| run: | | |
| mkdir -p dist | |
| tar -C linggen-cli/target/release -czf dist/linggen-cli-${{ matrix.rust-target }}.tar.gz linggen | |
| tar -C backend/target/release -czf dist/linggen-server-${{ matrix.rust-target }}.tar.gz linggen-server | |
| - name: Setup Tauri sidecar | |
| shell: bash | |
| run: | | |
| SIDECAR_NAME="linggen-server-${{ matrix.sidecar-target }}" | |
| cp "backend/target/release/linggen-server" "frontend/src-tauri/${SIDECAR_NAME}" | |
| chmod +x "frontend/src-tauri/${SIDECAR_NAME}" | |
| echo "Sidecar created: ${SIDECAR_NAME}" | |
| - name: Build Tauri app | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY }} | |
| TAURI_SIGNING_PRIVATE_KEY_PASSWORD: ${{ secrets.TAURI_SIGNING_PRIVATE_KEY_PASSWORD }} | |
| with: | |
| projectPath: frontend | |
| args: ${{ matrix.args }} | |
| - name: Upload artifacts | |
| uses: actions/upload-artifact@v4 | |
| with: | |
| name: linggen-${{ matrix.platform }} | |
| path: | | |
| frontend/src-tauri/target/*/release/bundle/dmg/*.dmg | |
| frontend/src-tauri/target/*/release/bundle/dmg/*.dmg.tar.gz | |
| frontend/src-tauri/target/*/release/bundle/dmg/*.dmg.tar.gz.sig | |
| frontend/src-tauri/target/release/bundle/deb/*.deb | |
| frontend/src-tauri/target/release/bundle/deb/*.deb.tar.gz | |
| frontend/src-tauri/target/release/bundle/deb/*.deb.tar.gz.sig | |
| frontend/src-tauri/target/release/bundle/appimage/*.AppImage | |
| frontend/src-tauri/target/release/bundle/appimage/*.AppImage.tar.gz | |
| frontend/src-tauri/target/release/bundle/appimage/*.AppImage.tar.gz.sig | |
| dist/*.tar.gz | |
| if-no-files-found: ignore | |
| publish-to-releases-repo: | |
| needs: build-release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout linggen repository | |
| uses: actions/checkout@v4 | |
| - name: Download all artifacts | |
| uses: actions/download-artifact@v4 | |
| with: | |
| path: artifacts | |
| - name: Get version | |
| id: version | |
| run: | | |
| if [ "${{ github.event_name }}" == "workflow_dispatch" ]; then | |
| echo "version=${{ github.event.inputs.version }}" >> $GITHUB_OUTPUT | |
| else | |
| echo "version=${GITHUB_REF#refs/tags/}" >> $GITHUB_OUTPUT | |
| fi | |
| - name: List artifacts | |
| run: | | |
| echo "Downloaded artifacts:" | |
| find artifacts -type f | |
| - name: Generate manifests | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| VERSION_NUM="${VERSION#v}" | |
| BASE_URL="https://github.com/linggen/linggen-releases/releases/download/${VERSION}" | |
| DMG=$(find artifacts -name "*.dmg" | head -n 1) | |
| DEB=$(find artifacts -name "*.deb" | head -n 1) | |
| CLI_MAC=$(find artifacts -name "linggen-cli-universal-apple-darwin.tar.gz" | head -n 1) | |
| CLI_LINUX=$(find artifacts -name "linggen-cli-x86_64-unknown-linux-gnu.tar.gz" | head -n 1) | |
| SRV_MAC=$(find artifacts -name "linggen-server-universal-apple-darwin.tar.gz" | head -n 1) | |
| SRV_LINUX=$(find artifacts -name "linggen-server-x86_64-unknown-linux-gnu.tar.gz" | head -n 1) | |
| DMG_BASENAME=$(basename "$DMG") | |
| DEB_BASENAME=$(basename "$DEB") | |
| CLI_MAC_BASENAME=$(basename "$CLI_MAC") | |
| CLI_LINUX_BASENAME=$(basename "$CLI_LINUX") | |
| SRV_MAC_BASENAME=$(basename "$SRV_MAC") | |
| SRV_LINUX_BASENAME=$(basename "$SRV_LINUX") | |
| cat > latest.json << EOF | |
| { | |
| "version": "${VERSION_NUM}", | |
| "notes": "See release notes at https://github.com/linggen/linggen-releases/releases/tag/${VERSION}", | |
| "pub_date": "$(date -u +%Y-%m-%dT%H:%M:%SZ)", | |
| "platforms": { | |
| "darwin-universal": { | |
| "signature": "", | |
| "url": "${BASE_URL}/${DMG_BASENAME}" | |
| }, | |
| "linux-x86_64": { | |
| "signature": "", | |
| "url": "${BASE_URL}/${DEB_BASENAME}" | |
| } | |
| } | |
| } | |
| EOF | |
| cat > manifest.json << EOF | |
| { | |
| "version": "${VERSION_NUM}", | |
| "artifacts": { | |
| "cli-macos-universal": {"url": "${BASE_URL}/${CLI_MAC_BASENAME}"}, | |
| "cli-linux-x86_64": {"url": "${BASE_URL}/${CLI_LINUX_BASENAME}"}, | |
| "server-macos-universal": {"url": "${BASE_URL}/${SRV_MAC_BASENAME}"}, | |
| "server-linux-x86_64": {"url": "${BASE_URL}/${SRV_LINUX_BASENAME}"}, | |
| "app-macos-dmg": {"url": "${BASE_URL}/${DMG_BASENAME}"}, | |
| "app-linux": {"url": "${BASE_URL}/${DEB_BASENAME}"} | |
| } | |
| } | |
| EOF | |
| echo "Generated latest.json:" | |
| cat latest.json | |
| echo "Generated manifest.json:" | |
| cat manifest.json | |
| - name: Checkout linggen-releases repository | |
| uses: actions/checkout@v4 | |
| with: | |
| repository: linggen/linggen-releases | |
| token: ${{ secrets.RELEASES_PAT }} | |
| path: linggen-releases | |
| - name: Create release in linggen-releases | |
| env: | |
| GH_TOKEN: ${{ secrets.RELEASES_PAT }} | |
| run: | | |
| VERSION="${{ steps.version.outputs.version }}" | |
| cd linggen-releases | |
| gh release create "${VERSION}" \ | |
| --title "Linggen ${VERSION}" \ | |
| --notes "Release ${VERSION} - See main repository for details" \ | |
| --draft | |
| find ../artifacts -name "*.dmg" -exec gh release upload "${VERSION}" {} \; | |
| find ../artifacts -name "*.deb" -exec gh release upload "${VERSION}" {} \; | |
| find ../artifacts -name "linggen-cli-*.tar.gz" -exec gh release upload "${VERSION}" {} \; | |
| find ../artifacts -name "linggen-server-*.tar.gz" -exec gh release upload "${VERSION}" {} \; | |
| find ../artifacts -name "*.AppImage" -exec gh release upload "${VERSION}" {} \; | |
| # Upload manifests | |
| gh release upload "${VERSION}" ../latest.json ../manifest.json | |
| gh release edit "${VERSION}" --draft=false | |
| echo "Release ${VERSION} published successfully!" |