Active strict-dep-builds for pnpm 10.3 #517
This file contains 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: | |
push: | |
branches: | |
- main | |
- hotfix/** | |
workflow_dispatch: | |
env: | |
RELEASE_CONFIG_FILE: release.json | |
RUSTFLAGS: --deny warnings | |
# renovate: datasource=crate versioning=semver-coerced depName=cargo-release | |
VERSION_CARGO_RELEASE: 0.25.17 | |
# renovate: datasource=npm versioning=semver-coerced depName=corepack | |
VERSION_COREPACK: 0.31.0 | |
# renovate: datasource=crate versioning=semver-coerced depName=parse-changelog | |
VERSION_PARSE_CHANGELOG: 0.6.12 | |
jobs: | |
ci: | |
name: CI | |
uses: ./.github/workflows/ci.yml | |
find-release: | |
name: Find release | |
runs-on: ubuntu-latest | |
steps: | |
- name: Get merged PR | |
id: get-merged-pr | |
uses: actions-ecosystem/action-get-merged-pull-request@v1.0.1 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
outputs: | |
is-release: ${{ contains(steps.get-merged-pr.outputs.labels, 'release') }} | |
pr-number: ${{ steps.get-merged-pr.outputs.number }} | |
release-notes: ${{ steps.get-merged-pr.outputs.body }} | |
update-pending-release: | |
name: Update pending release | |
runs-on: ubuntu-latest | |
needs: find-release | |
if: needs.find-release.outputs.is-release == 'false' | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Determine version bump | |
id: determine-version-bump | |
run: | | |
bump=$(jq --raw-output .versionBump "$RELEASE_CONFIG_FILE") | |
case "$bump" in | |
none|patch) ;; | |
major|minor) | |
if [ "$GITHUB_REF_NAME" != 'main' ]; then | |
>&2 echo "Version bump '$bump' is only allowed on main branch" | |
exit 1 | |
fi ;; | |
*) | |
>&2 echo "Invalid version bump '$bump'" | |
exit 1 ;; | |
esac | |
echo "bump=$bump" | tee --append "$GITHUB_OUTPUT" | |
- name: Install stable toolchain | |
if: steps.determine-version-bump.outputs.bump != 'none' | |
uses: dtolnay/rust-toolchain@stable | |
- name: Rust cache | |
if: steps.determine-version-bump.outputs.bump != 'none' | |
uses: swatinem/rust-cache@v2 | |
- name: Cache cargo-release | |
id: cache-cargo-release | |
if: steps.determine-version-bump.outputs.bump != 'none' | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/ | |
key: cargo-release-${{ env.VERSION_CARGO_RELEASE }} | |
- name: Install cargo-release | |
if: steps.determine-version-bump.outputs.bump != 'none' && !steps.cache-cargo-release.outputs.cache-hit | |
run: cargo install cargo-release@${{ env.VERSION_CARGO_RELEASE }} | |
- name: Cache parse-changelog | |
id: cache-parse-changelog | |
if: steps.determine-version-bump.outputs.bump != 'none' | |
uses: actions/cache@v4 | |
with: | |
path: ~/.cargo/ | |
key: parse-changelog-${{ env.VERSION_PARSE_CHANGELOG }} | |
- name: Install parse-changelog | |
if: steps.determine-version-bump.outputs.bump != 'none' && !steps.cache-parse-changelog.outputs.cache-hit | |
run: cargo install parse-changelog@${{ env.VERSION_PARSE_CHANGELOG }} | |
- name: Pre-release | |
id: pre-release | |
if: steps.determine-version-bump.outputs.bump != 'none' | |
env: | |
BUMP: ${{ steps.determine-version-bump.outputs.bump }} | |
run: | | |
# Reset release config file | |
temp=$(mktemp) | |
jq '.versionBump = "none"' "$RELEASE_CONFIG_FILE" > "$temp" && mv "$temp" "$RELEASE_CONFIG_FILE" | |
# Bump version | |
cargo release version "$BUMP" --execute --no-confirm | |
# Apply pre-release replacements | |
cargo release replace --execute --no-confirm | |
# Determine new version | |
version=$(cargo metadata --no-deps --format-version 1 | jq --raw-output '.packages[] | select(.name == "annimate_desktop") .version') | |
echo "version=$version" | tee --append "$GITHUB_OUTPUT" | |
# Determine release notes from changelog | |
echo 'Release notes:' | |
echo '--' | |
echo 'RELEASE_NOTES<<EOF' >> "$GITHUB_ENV" | |
echo -n '## ' | tee --append "$GITHUB_ENV" | |
parse-changelog --title CHANGELOG.md "$version" | tee --append "$GITHUB_ENV" | |
echo '' | tee --append "$GITHUB_ENV" | |
parse-changelog CHANGELOG.md "$version" | tee --append "$GITHUB_ENV" | |
echo '' | tee --append "$GITHUB_ENV" | |
grep "^\[$version\]" CHANGELOG.md | tee --append "$GITHUB_ENV" | |
echo 'EOF' >> "$GITHUB_ENV" | |
echo '--' | |
- name: Create pull request | |
uses: peter-evans/create-pull-request@v7 | |
with: | |
# use PAT instead of GITHUB_TOKEN so created PR can trigger workflows | |
# see https://github.com/peter-evans/create-pull-request/issues/48 | |
token: ${{ secrets.RELEASE_GITHUB_TOKEN }} | |
branch: release/${{ github.ref_name }} | |
author: Matthias Stemmler <matthias.stemmler@gmail.com> | |
commit-message: "Bump version to ${{ steps.pre-release.outputs.version }}" | |
delete-branch: true | |
labels: release | |
title: Release v${{ steps.pre-release.outputs.version }} | |
body: ${{ env.RELEASE_NOTES }} | |
create-release: | |
name: Create release | |
needs: | |
- ci | |
- find-release | |
if: needs.find-release.outputs.is-release == 'true' | |
permissions: | |
contents: write | |
strategy: | |
fail-fast: false | |
matrix: | |
include: | |
- os: 'macos-latest' | |
target: 'aarch64-apple-darwin' | |
- os: 'macos-latest' | |
target: 'x86_64-apple-darwin' | |
- os: 'ubuntu-22.04' | |
- os: 'windows-latest' | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Install Tauri dependencies (Linux only) | |
if: runner.os == 'Linux' | |
run: >- | |
sudo apt-get update && | |
sudo apt-get install -y | |
libgtk-3-dev | |
libwebkit2gtk-4.1-dev | |
- name: Install stable toolchain | |
uses: dtolnay/rust-toolchain@stable | |
with: | |
targets: ${{ matrix.target }} | |
- name: Rust cache | |
uses: swatinem/rust-cache@v2 | |
# Install a specific version of corepack to make sure we have the latest signing keys | |
- name: Install corepack | |
run: npm install --global corepack@${{ env.VERSION_COREPACK }} | |
- name: Enable corepack | |
run: corepack enable | |
- name: Set up node | |
uses: actions/setup-node@v4 | |
with: | |
cache: pnpm | |
cache-dependency-path: annimate_desktop/pnpm-lock.yaml | |
node-version-file: annimate_desktop/.nvmrc | |
- name: Install (pnpm) | |
run: pnpm install | |
working-directory: annimate_desktop | |
- name: Create release | |
id: create-release | |
uses: tauri-apps/tauri-action@v0.5.19 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
TAURI_SIGNING_PRIVATE_KEY: ${{ secrets.TAURI_PRIVATE_KEY }} | |
with: | |
args: ${{ matrix.target != null && format('--target {0}', matrix.target) || '' }} | |
projectPath: annimate_desktop | |
releaseBody: ${{ needs.find-release.outputs.release-notes }} | |
releaseDraft: true | |
releaseName: v__VERSION__ | |
tagName: v__VERSION__ | |
outputs: | |
release-id: ${{ steps.create-release.outputs.releaseId }} | |
publish-release: | |
name: Publish release | |
needs: | |
- find-release | |
- create-release | |
if: needs.find-release.outputs.is-release == 'true' | |
runs-on: ubuntu-latest | |
steps: | |
- uses: eregon/publish-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
release_id: ${{ needs.create-release.outputs.release-id }} |