Release (Manual) #11
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 (Manual) | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version: | |
| description: 'Version to release (e.g., 0.2.0)' | |
| required: true | |
| type: string | |
| prerelease: | |
| description: 'Is this a pre-release?' | |
| required: false | |
| type: boolean | |
| default: false | |
| permissions: | |
| contents: write | |
| jobs: | |
| create-tag: | |
| name: Create Tag | |
| runs-on: ubuntu-latest | |
| outputs: | |
| tag_name: v${{ inputs.version }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| - name: Configure Git | |
| run: | | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| - name: Create and push tag | |
| run: | | |
| TAG_NAME="v${{ inputs.version }}" | |
| if git rev-parse "$TAG_NAME" >/dev/null 2>&1; then | |
| echo "Tag $TAG_NAME already exists" | |
| else | |
| git tag -a "$TAG_NAME" -m "Release $TAG_NAME" | |
| git push origin "$TAG_NAME" | |
| fi | |
| build: | |
| name: Build & Release | |
| needs: create-tag | |
| runs-on: windows-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| ref: v${{ inputs.version }} | |
| fetch-depth: 0 | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 10 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 24 | |
| cache: pnpm | |
| - name: Setup Rust | |
| uses: dtolnay/rust-toolchain@stable | |
| - name: Cache cargo | |
| uses: Swatinem/rust-cache@v2 | |
| with: | |
| workspaces: src-tauri | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Generate changelog | |
| id: changelog | |
| run: | | |
| TAG_NAME="v${{ inputs.version }}" | |
| PREV_TAG=$(git tag --sort=-v:refname | grep -E '^v[0-9]' | grep -v "$TAG_NAME" | head -1) | |
| if [ -z "$PREV_TAG" ]; then | |
| RANGE="$TAG_NAME" | |
| else | |
| RANGE="${PREV_TAG}..${TAG_NAME}" | |
| fi | |
| echo "Generating changelog for $RANGE" | |
| CHANGELOG="" | |
| add_section() { | |
| local title="$1" prefix="$2" | |
| local entries=$(git log "$RANGE" --pretty=format:"%s" --grep="^${prefix}" | sed "s/^${prefix}[:(][^)]*)[: ]*//" | sed "s/^${prefix}: //" | sed 's/^/- /') | |
| if [ -n "$entries" ]; then | |
| CHANGELOG="${CHANGELOG}### ${title}\n\n${entries}\n\n" | |
| fi | |
| } | |
| add_section "Features" "feat" | |
| add_section "Bug Fixes" "fix" | |
| add_section "Performance" "perf" | |
| add_section "Refactor" "refactor" | |
| add_section "Documentation" "docs" | |
| # Miscellaneous (chore, excluding release/version bumps) | |
| MISC=$(git log "$RANGE" --pretty=format:"%s" --grep="^chore" | grep -v -E "^chore\((release|version)\)" | grep -v "^chore: version" | sed 's/^chore[:(][^)]*)[: ]*//' | sed 's/^chore: //' | sed 's/^/- /') | |
| if [ -n "$MISC" ]; then | |
| CHANGELOG="${CHANGELOG}### Miscellaneous\n\n${MISC}\n\n" | |
| fi | |
| if [ -z "$CHANGELOG" ]; then | |
| CHANGELOG="No notable changes." | |
| fi | |
| # Write to file for multi-line safety | |
| echo -e "$CHANGELOG" > changelog.md | |
| shell: bash | |
| - name: Build and Release | |
| 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 }} | |
| with: | |
| tagName: v${{ inputs.version }} | |
| releaseName: 'Ntfier v${{ inputs.version }}' | |
| releaseBody: '' | |
| releaseDraft: true | |
| prerelease: ${{ inputs.prerelease }} | |
| - name: Update release with changelog and update.json | |
| run: | | |
| node scripts/generate-update-json.js | |
| gh release edit "v${{ inputs.version }}" --notes-file changelog.md | |
| gh release upload "v${{ inputs.version }}" update.json --clobber | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| TAG_NAME: v${{ inputs.version }} |