Release #8
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: | |
| inputs: | |
| operation: | |
| description: Prepare a release PR, dry-run publish, or publish from main | |
| required: true | |
| type: choice | |
| default: prepare-release-pr | |
| options: | |
| - prepare-release-pr | |
| - publish-dry-run | |
| - publish | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pull-requests: write | |
| concurrency: | |
| group: release-${{ github.ref }} | |
| cancel-in-progress: false | |
| env: | |
| CARGO_TERM_COLOR: always | |
| RUST_BACKTRACE: 1 | |
| PREK_VERSION: 0.3.10 | |
| jobs: | |
| prepare-release-pr: | |
| name: Prepare Release PR | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| if: ${{ github.repository == 'f0rr0/pglite-oxide' && inputs.operation == 'prepare-release-pr' }} | |
| steps: | |
| - name: Require main | |
| run: | | |
| if [[ "${GITHUB_REF}" != "refs/heads/main" ]]; then | |
| echo "Releases must be run from main; got ${GITHUB_REF}" >&2 | |
| exit 1 | |
| fi | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: 1.92 | |
| - name: Create or update release PR | |
| uses: release-plz/action@v0.5 | |
| with: | |
| command: release-pr | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| publish: | |
| name: Publish Release | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 120 | |
| if: ${{ github.repository == 'f0rr0/pglite-oxide' && inputs.operation != 'prepare-release-pr' }} | |
| environment: ${{ inputs.operation == 'publish' && 'crates-io' || 'release-dry-run' }} | |
| steps: | |
| - name: Require main | |
| run: | | |
| if [[ "${GITHUB_REF}" != "refs/heads/main" ]]; then | |
| echo "Releases must be run from main; got ${GITHUB_REF}" >&2 | |
| exit 1 | |
| fi | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Install Tauri Linux dependencies | |
| run: | | |
| sudo apt-get update | |
| sudo apt-get install -y \ | |
| libayatana-appindicator3-dev \ | |
| libssl-dev \ | |
| libwebkit2gtk-4.1-dev \ | |
| librsvg2-dev \ | |
| patchelf \ | |
| pkg-config | |
| - name: Install Rust toolchain | |
| uses: dtolnay/rust-toolchain@master | |
| with: | |
| toolchain: 1.92 | |
| components: rustfmt, clippy | |
| - name: Install Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| cache-dependency-path: examples/tauri-sqlx-vanilla/package-lock.json | |
| - uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: | | |
| . -> target | |
| examples/tauri-sqlx-vanilla/src-tauri -> target | |
| - name: Install prek | |
| uses: taiki-e/install-action@v2 | |
| with: | |
| tool: prek@${{ env.PREK_VERSION }} | |
| - name: Validate package checks | |
| run: scripts/validate.sh ci | |
| - name: Validate publish dry run | |
| run: scripts/validate.sh release | |
| - name: Supply-chain policy | |
| uses: EmbarkStudios/cargo-deny-action@v2 | |
| - name: Run release-plz dry run | |
| if: ${{ inputs.operation == 'publish-dry-run' }} | |
| uses: release-plz/action@v0.5 | |
| with: | |
| command: release | |
| dry_run: true | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Run release-plz publish | |
| if: ${{ inputs.operation == 'publish' }} | |
| id: release_plz_publish | |
| uses: release-plz/action@v0.5 | |
| with: | |
| command: release | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Require release output | |
| if: ${{ inputs.operation == 'publish' && steps.release_plz_publish.outputs.releases_created != 'true' }} | |
| run: | | |
| echo "release-plz completed without creating a release." >&2 | |
| echo "Check that Cargo.toml contains an unpublished version and that release-plz was run without dry_run." >&2 | |
| exit 1 |