Release smoke app #24
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 smoke app | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_tag: | |
| description: Package release tag, for example create-tauri-ui@1.0.1 | |
| required: true | |
| type: string | |
| release_id: | |
| description: GitHub release numeric id | |
| required: true | |
| type: string | |
| portable_only: | |
| description: Build and upload only the Windows portable executable | |
| required: false | |
| default: false | |
| type: boolean | |
| release: | |
| types: | |
| - created | |
| - published | |
| - released | |
| concurrency: ${{ github.workflow }}-${{ github.run_id }} | |
| jobs: | |
| prepare-matrix: | |
| name: Prepare smoke matrix | |
| runs-on: ubuntu-latest | |
| outputs: | |
| matrix: ${{ steps.matrix.outputs.value }} | |
| steps: | |
| - name: Select artifacts | |
| id: matrix | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ] && [ "${{ inputs.portable_only }}" = "true" ]; then | |
| value='{"include":[{"name":"Windows Portable","platform":"windows-latest","args":"--no-bundle","asset_suffix":"windows-x64-portable","upload_plain_binary":true}]}' | |
| else | |
| value='{"include":[{"name":"Windows","platform":"windows-latest","args":"","asset_suffix":"windows-x64","upload_plain_binary":false},{"name":"Windows Portable","platform":"windows-latest","args":"--no-bundle","asset_suffix":"windows-x64-portable","upload_plain_binary":true},{"name":"macOS Apple Silicon","platform":"macos-latest","args":"--target aarch64-apple-darwin","asset_suffix":"macos-apple-silicon","upload_plain_binary":false},{"name":"macOS Intel","platform":"macos-latest","args":"--target x86_64-apple-darwin","asset_suffix":"macos-intel","upload_plain_binary":false},{"name":"Linux","platform":"ubuntu-22.04","args":"","asset_suffix":"linux-x64","upload_plain_binary":false}]}' | |
| fi | |
| echo "value=$value" >> "$GITHUB_OUTPUT" | |
| publish-smoke-app: | |
| name: Upload generated Vite app | |
| needs: prepare-matrix | |
| if: | | |
| (github.event_name == 'release' && startsWith(github.event.release.tag_name, 'create-tauri-ui@')) || | |
| (github.event_name == 'workflow_dispatch' && startsWith(inputs.release_tag, 'create-tauri-ui@')) | |
| permissions: | |
| contents: write | |
| defaults: | |
| run: | |
| shell: bash | |
| strategy: | |
| fail-fast: false | |
| matrix: ${{ fromJSON(needs.prepare-matrix.outputs.matrix) }} | |
| runs-on: ${{ matrix.platform }} | |
| env: | |
| APP_DIR: release-smoke-app | |
| steps: | |
| - name: Resolve release metadata | |
| id: release | |
| run: | | |
| if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then | |
| VERSION="$(printf '%s' '${{ inputs.release_tag }}' | sed 's/^.*@//')" | |
| echo "tag=${{ inputs.release_tag }}" >> "$GITHUB_OUTPUT" | |
| echo "id=${{ inputs.release_id }}" >> "$GITHUB_OUTPUT" | |
| echo "url=https://github.com/${{ github.repository }}/releases/tag/${{ inputs.release_tag }}" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| exit 0 | |
| fi | |
| VERSION="$(printf '%s' '${{ github.event.release.tag_name }}' | sed 's/^.*@//')" | |
| echo "tag=${{ github.event.release.tag_name }}" >> "$GITHUB_OUTPUT" | |
| echo "id=${{ github.event.release.id }}" >> "$GITHUB_OUTPUT" | |
| echo "url=${{ github.event.release.html_url }}" >> "$GITHUB_OUTPUT" | |
| echo "version=$VERSION" >> "$GITHUB_OUTPUT" | |
| - name: Checkout release tag | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: ${{ steps.release.outputs.tag }} | |
| - name: Install Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| with: | |
| targets: ${{ matrix.platform == 'macos-latest' && 'aarch64-apple-darwin,x86_64-apple-darwin' || '' }} | |
| - name: Rust cache | |
| uses: Swatinem/rust-cache@v2 | |
| - name: Install Bun | |
| uses: oven-sh/setup-bun@v2 | |
| with: | |
| bun-version: 1.3.14 | |
| - name: Install Linux system dependencies | |
| if: matrix.platform == 'ubuntu-22.04' | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y --no-install-recommends libwebkit2gtk-4.1-dev libgtk-3-dev libayatana-appindicator3-dev librsvg2-dev patchelf | |
| - name: Install workspace dependencies | |
| run: bun install --frozen-lockfile | |
| - name: Build create-tauri-ui | |
| run: bun run --cwd packages/create-tauri-ui build | |
| - name: Generate release smoke app | |
| run: | | |
| rm -rf "$APP_DIR" | |
| node packages/create-tauri-ui/index.js "$APP_DIR" \ | |
| --template vite \ | |
| --identifier com.agm.create-tauri-ui-release-smoke \ | |
| --size-optimize \ | |
| --yes \ | |
| --no-workflow | |
| - name: Install smoke app dependencies | |
| working-directory: ${{ env.APP_DIR }} | |
| run: bun install | |
| - name: Build and upload smoke app | |
| id: tauri | |
| uses: tauri-apps/tauri-action@action-v0.6.2 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| APPLE_SIGNING_IDENTITY: ${{ startsWith(matrix.platform, 'macos-') && '-' || '' }} | |
| with: | |
| releaseId: ${{ steps.release.outputs.id }} | |
| projectPath: ${{ env.APP_DIR }} | |
| appName: tauri-ui-smoke | |
| appVersion: ${{ steps.release.outputs.version }} | |
| args: ${{ matrix.args }} | |
| retryAttempts: 2 | |
| assetNamePattern: "tauri-ui-smoke-v${{ steps.release.outputs.version }}-${{ matrix.asset_suffix }}[ext]" | |
| uploadPlainBinary: ${{ matrix.upload_plain_binary }} | |
| includeUpdaterJson: false | |
| - name: Smoke app summary | |
| if: steps.tauri.outputs.releaseHtmlUrl != '' | |
| run: | | |
| { | |
| echo "## Generated Vite smoke app" | |
| echo "" | |
| echo "- Package release: ${{ steps.release.outputs.url }}" | |
| echo "- Platform: \`${{ matrix.name }}\`" | |
| echo "- App version: \`${{ steps.tauri.outputs.appVersion }}\`" | |
| echo "- Size optimization: \`enabled\`" | |
| echo "- Artifacts: \`${{ steps.tauri.outputs.artifactPaths }}\`" | |
| } >> "$GITHUB_STEP_SUMMARY" |