Manual Release #1
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: Manual Release | |
| on: | |
| workflow_dispatch: | |
| inputs: | |
| version_type: | |
| description: 'Version increment type' | |
| required: true | |
| default: 'patch' | |
| type: choice | |
| options: | |
| - patch | |
| - minor | |
| - major | |
| dry_run: | |
| description: 'Dry run (do not publish)' | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| release: | |
| name: Manual Release | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v5 | |
| with: | |
| node-version: 22 | |
| cache: npm | |
| registry-url: https://registry.npmjs.org | |
| - name: Install dependencies | |
| shell: bash | |
| run: | | |
| if [ -f package-lock.json ]; then | |
| npm ci | |
| else | |
| npm install | |
| fi | |
| - name: Configure Git | |
| shell: bash | |
| run: | | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| - name: Run quality gates | |
| shell: bash | |
| run: | | |
| npm run typecheck | |
| npm run test:coverage | |
| npm run build | |
| - name: Bump version | |
| id: version | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then | |
| echo "π DRY RUN MODE - No changes will be made" | |
| CURRENT_VERSION=$(node -p "require('./package.json').version") | |
| echo "current_version=$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| echo "new_version=dry-run-$CURRENT_VERSION" >> $GITHUB_OUTPUT | |
| else | |
| npm version ${{ github.event.inputs.version_type }} --no-git-tag-version | |
| NEW_VERSION=$(node -p "require('./package.json').version") | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| # Commit version bump | |
| git add package.json | |
| git commit -m "chore: bump version to v$NEW_VERSION" | |
| git push origin main | |
| # Create and push tag | |
| git tag "v$NEW_VERSION" | |
| git push origin "v$NEW_VERSION" | |
| fi | |
| - name: Publish to NPM | |
| if: github.event.inputs.dry_run == 'false' | |
| run: npm publish --access public | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Create GitHub Release | |
| if: github.event.inputs.dry_run == 'false' | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: v${{ steps.version.outputs.new_version }} | |
| release_name: Release v${{ steps.version.outputs.new_version }} | |
| body: | | |
| ## Manual Release v${{ steps.version.outputs.new_version }} | |
| This is a manually triggered release. | |
| ### Installation | |
| ```bash | |
| npm install hero-crypto-csv-parser@${{ steps.version.outputs.new_version }} | |
| ``` | |
| ### Changes | |
| Please check the commit history for detailed changes since the last release. | |
| draft: false | |
| prerelease: false | |
| - name: Summary | |
| shell: bash | |
| run: | | |
| if [ "${{ github.event.inputs.dry_run }}" = "true" ]; then | |
| echo "π **DRY RUN COMPLETED**" | |
| echo "- Quality gates: β Passed" | |
| echo "- Version would be bumped: ${{ github.event.inputs.version_type }}" | |
| echo "- Current version: ${{ steps.version.outputs.current_version }}" | |
| else | |
| echo "π **RELEASE COMPLETED**" | |
| echo "- Version: v${{ steps.version.outputs.new_version }}" | |
| echo "- Type: ${{ github.event.inputs.version_type }}" | |
| echo "- Published to NPM: β " | |
| echo "- GitHub Release: β " | |
| fi |