Release #142
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: | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
| jobs: | |
| semantic-release: | |
| name: Semantic Release | |
| runs-on: ubuntu-latest | |
| outputs: | |
| should_run: ${{ steps.check_asset_count.outputs.should_run }} | |
| permissions: | |
| contents: write | |
| issues: write | |
| pull-requests: write | |
| packages: read | |
| id-token: write | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| ref: main | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "lts/*" | |
| registry-url: https://npm.pkg.github.com | |
| scope: "@seenivers" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v5.0.0 | |
| with: | |
| version: 10.32.1 | |
| - name: Install dependencies | |
| run: pnpm install | |
| - name: Release | |
| id: semantic_release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| NPM_TOKEN: ${{ secrets.GHCR_TOKEN }} | |
| run: pnpm exec semantic-release | |
| - name: Save Release Details | |
| id: log_release_details | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| tag_name=$(gh release view --json tagName --jq '.tagName') | |
| body=$(gh release view --json body --jq '.body' | sed 's/"/'"'"'/g') | |
| id=$(gh release view --json id --jq '.id') | |
| draft=$(gh release view --json isDraft --jq '.isDraft') | |
| prerelease=$(gh release view --json isPrerelease --jq '.isPrerelease') | |
| asset_count=$(gh release view --json assets --jq '.assets | length') | |
| echo "asset_count=${asset_count}" >> $GITHUB_ENV | |
| echo '{ | |
| "tag_name": "'"${tag_name}"'", | |
| "id": "'"${id}"'", | |
| "body": "'"${body//$'\n'/\\n}"'", | |
| "prerelease": '"$prerelease"', | |
| "draft": '"$draft"' | |
| }' > release_info.json | |
| - name: Upload Release Details | |
| uses: actions/upload-artifact@v7 | |
| with: | |
| name: release-info | |
| path: release_info.json | |
| - name: Check Asset Count | |
| id: check_asset_count | |
| shell: bash | |
| run: | | |
| if [[ $asset_count -gt 3 ]]; then | |
| echo "More than 3 assets found. Skipping Tauri Release. (${asset_count})" | |
| echo "should_run=false" >> $GITHUB_OUTPUT | |
| else | |
| echo "should_run=true" >> $GITHUB_OUTPUT | |
| fi | |
| format: | |
| name: Code Formatting | |
| needs: semantic-release | |
| permissions: | |
| contents: write | |
| packages: read | |
| uses: ./.github/workflows/format.yml | |
| tauri-release: | |
| name: Tauri Release | |
| needs: format | |
| if: needs.semantic-release.outputs.should_run == 'true' | |
| permissions: | |
| contents: write | |
| packages: read | |
| 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 }} | |
| steps: | |
| - name: Download Release Details | |
| uses: actions/download-artifact@v8 | |
| with: | |
| name: release-info | |
| - name: Read Release Details | |
| id: read_release_details | |
| shell: bash | |
| run: | | |
| release_info=$(cat release_info.json) | |
| tag_name=$(echo "$release_info" | jq -r '.tag_name') | |
| id=$(echo "$release_info" | jq -r '.id') | |
| body=$(echo "$release_info" | jq -r '.body') | |
| draft=$(echo "$release_info" | jq -r '.draft') | |
| prerelease=$(echo "$release_info" | jq -r '.prerelease') | |
| body=$(printf '%s' "$body" | awk '{gsub(/"/, "\\\""); printf "%s\\n", $0}' | tr '\n' '\\' | sed 's/\\$//') | |
| echo "release_details={\"tag_name\":\"${tag_name}\",\"release_name\":\"App ${tag_name}\",\"release_body\":\"${body}\",\"release_id\":\"${id}\",\"release_draft\":${draft},\"prerelease\":${prerelease}}" >> $GITHUB_ENV | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 1 | |
| ref: main | |
| - name: Setup Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: "lts/*" | |
| registry-url: https://npm.pkg.github.com | |
| scope: "@seenivers" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v5.0.0 | |
| with: | |
| version: 10.32.1 | |
| - name: Install Rust stable | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
| - name: Install dependencies (Ubuntu only) | |
| 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 frontend dependencies | |
| run: pnpm install | |
| - name: Import Windows certificate | |
| if: matrix.platform == 'windows-latest' | |
| env: | |
| WINDOWS_CERTIFICATE: ${{ secrets.WINDOWS_CERTIFICATE }} | |
| WINDOWS_CERTIFICATE_PASSWORD: ${{ secrets.WINDOWS_CERTIFICATE_PASSWORD }} | |
| run: | | |
| [IO.File]::WriteAllBytes('cert.pfx', [Convert]::FromBase64String($env:WINDOWS_CERTIFICATE)) | |
| Import-PfxCertificate -Exportable -FilePath "cert.pfx" -CertStoreLocation 'cert:\CurrentUser\My' -Password (ConvertTo-SecureString -String $env:WINDOWS_CERTIFICATE_PASSWORD -Force -AsPlainText) | |
| - name: Build and Publish 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 }} | |
| SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
| with: | |
| tagName: ${{ fromJson(env.release_details).tag_name }} | |
| releaseName: ${{ fromJson(env.release_details).release_name }} | |
| releaseBody: ${{ fromJson(env.release_details).release_body }} | |
| releaseId: ${{ fromJson(env.release_details).release_id }} | |
| releaseDraft: ${{ fromJson(env.release_details).release_draft }} | |
| prerelease: ${{ fromJson(env.release_details).prerelease }} | |
| args: ${{ matrix.args }} |