Create Release #65
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: Create Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| release_type: | |
| type: choice | |
| description: Release Type | |
| default: stable | |
| options: | |
| - stable | |
| - alpha | |
| - beta | |
| - rc | |
| version_bump: | |
| type: choice | |
| description: Version Bump | |
| default: patch | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| continue_prerelease: | |
| type: boolean | |
| description: Continue existing prerelease (if available) | |
| default: false | |
| specific_version: | |
| type: string | |
| description: Specify exact version (e.g., 3.3.0-alpha.1) - overrides other version settings | |
| required: false | |
| is_dry_run: | |
| type: boolean | |
| description: Dry Run | |
| jobs: | |
| release-it: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: tibdex/github-app-token@v2 | |
| id: generate-token | |
| with: | |
| app_id: ${{ secrets.RELEASE_BOT_APP_ID }} | |
| private_key: ${{ secrets.RELEASE_BOT_APP_PRIVATE_KEY }} | |
| - name: checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ steps.generate-token.outputs.token }} | |
| fetch-depth: 0 | |
| - name: debug git tags | |
| run: | | |
| echo "All tags:" | |
| git tag -l | |
| echo "---" | |
| echo "Tags sorted by version:" | |
| git tag -l --sort=-v:refname | |
| echo "---" | |
| echo "Alpha tags sorted by version:" | |
| git tag -l "*-alpha*" --sort=-v:refname | |
| echo "---" | |
| echo "Tag details:" | |
| git for-each-ref --format="%(refname:short) %(objecttype) %(taggerdate)" refs/tags/ | |
| echo "---" | |
| echo "Latest tag details:" | |
| LATEST_TAG=$(git describe --tags --abbrev=0) | |
| echo "Latest tag: $LATEST_TAG" | |
| git show $LATEST_TAG | |
| - name: initialize mandatory git config | |
| run: | | |
| git config user.name "GitHub Release Bot" | |
| git config user.email release-bot@neolution.ch | |
| - name: install release-it with plugins | |
| run: npm install -g release-it @release-it/keep-a-changelog | |
| - name: run release-it | |
| run: | | |
| params=() | |
| # Check if a specific version was provided | |
| if [[ -n "${{ github.event.inputs.specific_version }}" ]]; then | |
| params+=(--release=${{ github.event.inputs.specific_version }}) | |
| # Determine prerelease logic | |
| elif [[ "${{ github.event.inputs.release_type }}" == "stable" ]]; then | |
| params+=(--${{ github.event.inputs.version_bump }}) | |
| elif [[ "${{ github.event.inputs.continue_prerelease }}" == "true" ]]; then | |
| # Add verbose logging to understand release-it's process | |
| params+=(--verbose) | |
| # Tell release-it to use prerelease tags | |
| params+=(--preReleaseId=${{ github.event.inputs.release_type }}) | |
| params+=(--increment=prerelease) | |
| params+=(--preRelease=${{ github.event.inputs.release_type }}) | |
| params+=(--plugins.@release-it/keep-a-changelog.keepUnreleased) | |
| params+=(--no-plugins.@release-it/keep-a-changelog.strictLatest) | |
| else | |
| params+=(--${{ github.event.inputs.version_bump }}) | |
| params+=(--preRelease=${{ github.event.inputs.release_type }}) | |
| params+=(--plugins.@release-it/keep-a-changelog.keepUnreleased) | |
| params+=(--no-plugins.@release-it/keep-a-changelog.strictLatest) | |
| fi | |
| if [[ "${{ github.event.inputs.is_dry_run }}" == "true" ]]; then | |
| params+=(--dry-run) | |
| fi | |
| params+=(--ci) | |
| echo "command: release-it ${params[@]}" | |
| release-it "${params[@]}" | |
| env: | |
| GITHUB_TOKEN: ${{ steps.generate-token.outputs.token }} |