Skip to content

Release

Release #6

Workflow file for this run

# .github/workflows/release.yml
name: Release
on:
pull_request:
branches:
- main
types: [closed]
workflow_dispatch:
inputs:
release_type:
description: 'Type of release'
required: true
default: 'patch'
type: choice
options:
- patch
- minor
- major
permissions:
contents: write
pull-requests: write
jobs:
release-please:
runs-on: ubuntu-latest
# Only run on merged PRs or manual dispatch
if: github.event_name == 'workflow_dispatch' || (github.event.pull_request.merged == true)
outputs:
releases_created: ${{ steps.release_auto.outputs.releases_created || steps.manual_release.outputs.releases_created }}
tag_name: ${{ steps.release_auto.outputs.tag_name }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: πŸš€ Create Release PR or Release (Automatic)
if: github.event_name == 'pull_request'
id: release_auto
uses: googleapis/release-please-action@v4
with:
config-file: release-please-config.json
manifest-file: .release-please-manifest.json
- name: πŸ”§ Setup Node.js (Manual Release)
if: github.event_name == 'workflow_dispatch'
uses: actions/setup-node@v4
with:
node-version: '20'
- name: πŸš€ Create Manual Release PR
if: github.event_name == 'workflow_dispatch'
id: manual_release
run: |
npm install -g release-please
# Get current version from manifest
CURRENT_VERSION=$(cat .release-please-manifest.json | jq -r '.Website')
echo "Current version: $CURRENT_VERSION"
# Create release PR with specific version bump
release-please release-pr \
--repo-url="https://github.com/${{ github.repository }}" \
--config-file=release-please-config.json \
--manifest-file=.release-please-manifest.json \
--release-as=${{ github.event.inputs.release_type }} \
--token=${{ secrets.GITHUB_TOKEN }}
echo "releases_created=true" >> $GITHUB_OUTPUT
- name: πŸ“ Manual Release Summary
if: github.event_name == 'workflow_dispatch'
run: |
echo "βœ… Manual release PR created with type: ${{ github.event.inputs.release_type }}"
echo "πŸ” Check the Pull Requests tab for the release PR to review and merge."