chore: patch 2.0.4 #14
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: "Build & Publish Release (Auto-versioned)" | |
| on: | |
| push: | |
| paths: | |
| - "src-tauri/tauri.conf.json" | |
| branches: | |
| - main | |
| env: | |
| CLIENT_ID: ${{ secrets.CLIENT_ID }} | |
| CLIENT_SECRET: ${{ secrets.CLIENT_SECRET }} | |
| PROCEED_TO_AUTH_URI: ${{ secrets.PROCEED_TO_AUTH_URI }} | |
| FINNISH_AUTH_URI: ${{ secrets.FINNISH_AUTH_URI }} | |
| jobs: | |
| publish-tauri: | |
| permissions: | |
| contents: write | |
| strategy: | |
| fail-fast: false | |
| matrix: | |
| include: | |
| - platform: "macos-latest" | |
| args: "--target aarch64-apple-darwin" | |
| - platform: "macos-latest" | |
| args: "--target x86_64-apple-darwin" | |
| - platform: "ubuntu-22.04" | |
| args: "" | |
| - platform: "windows-latest" | |
| args: "" | |
| runs-on: ${{ matrix.platform }} | |
| defaults: | |
| run: | |
| shell: "bash" | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 # required for git diff to identify changes | |
| - name: Validate version change | |
| id: version_validation | |
| run: | | |
| cd src-tauri | |
| # Validate JSON structure | |
| if ! jq empty tauri.conf.json; then | |
| echo "::error::Invalid JSON in tauri.conf.json" | |
| exit 1 | |
| fi | |
| # Extract current version | |
| CURRENT_VERSION=$(jq -r '.version' tauri.conf.json) | |
| if [ "$CURRENT_VERSION" = "null" ] || [ -z "$CURRENT_VERSION" ]; then | |
| echo "::error::Version field missing in tauri.conf.json" | |
| exit 1 | |
| fi | |
| # Compare with previous version | |
| PREV_VERSION=$(git show HEAD^:src-tauri/tauri.conf.json | jq -r '.version') | |
| if [ "$CURRENT_VERSION" = "$PREV_VERSION" ]; then | |
| echo "::error::Version not changed (still $CURRENT_VERSION)" | |
| exit 1 | |
| fi | |
| echo "version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| - name: Set version environment variable | |
| run: echo "VERSION=${{ steps.version_validation.outputs.version }}" >> $GITHUB_ENV | |
| - name: Install Ubuntu dependencies | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y libwebkit2gtk-4.1-dev libappindicator3-dev librsvg2-dev patchelf | |
| - name: Install pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: latest | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: lts/* | |
| cache: "pnpm" | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
| - name: Cache Rust build | |
| uses: swatinem/rust-cache@v2 | |
| with: | |
| workspaces: "./src-tauri -> target" | |
| - name: Create .env file for Vite | |
| run: | | |
| echo VITE_CLIENT_ID=${{secrets.CLIENT_ID }} >> .env | |
| echo VITE_CLIENT_SECRET=${{secrets.CLIENT_SECRET }} >> .env | |
| echo VITE_PROCEED_TO_AUTH_URI=${{secrets.PROCEED_TO_AUTH_URI }} >> .env | |
| echo VITE_FINNISH_AUTH_URI=${{secrets.FINNISH_AUTH_URI }} >> .env | |
| - name: Create .env file for Tauri | |
| run: | | |
| echo CLIENT_ID=${{ secrets.CLIENT_ID }} >> ./src-tauri/.env | |
| echo CLIENT_SECRET=${{ secrets.CLIENT_SECRET }} >> ./src-tauri/.env | |
| - name: Install frontend dependencies | |
| run: pnpm install | |
| - name: Extract release notes | |
| id: changelog | |
| run: | | |
| # Extract everything between ## [2.0.1] and next ## | |
| NOTES=$(awk '/## \['"${{ env.VERSION }}"'\]/{flag=1;next}/## \[/{flag=0}flag' CHANGELOG.md) | |
| echo "notes<<EOF" >> $GITHUB_OUTPUT | |
| echo "$NOTES" >> $GITHUB_OUTPUT | |
| echo "EOF" >> $GITHUB_OUTPUT | |
| - name: Tauri build and publish | |
| uses: tauri-apps/tauri-action@v0 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tagName: "v${{ env.VERSION }}" | |
| releaseName: "Task Bridge ${{ env.VERSION }}" | |
| releaseBody: ${{ steps.changelog.outputs.notes }} | |
| releaseDraft: false | |
| prerelease: false | |
| args: ${{ matrix.args }} |