|
| 1 | +name: Manual Release |
| 2 | +on: |
| 3 | + workflow_dispatch: |
| 4 | + inputs: |
| 5 | + version: |
| 6 | + description: 'Version' |
| 7 | + type: choice |
| 8 | + required: true |
| 9 | + default: fix |
| 10 | + options: |
| 11 | + - fix |
| 12 | + - feat |
| 13 | + - BREAKING CHANGE |
| 14 | + dryRun: |
| 15 | + description: 'DryRun' |
| 16 | + type: boolean |
| 17 | + default: true |
| 18 | +# ENV and Config |
| 19 | +env: |
| 20 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 21 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 22 | + GIT_AUTHOR_NAME: github-actions |
| 23 | + GIT_AUTHOR_EMAIL: github-actions@github.com |
| 24 | + GIT_COMMITTER_NAME: github-actions |
| 25 | + GIT_COMMITTER_EMAIL: github-actions@github.com |
| 26 | + CI: true |
| 27 | + CONFIG_NODE_VERSION: '["20.x"]' |
| 28 | + CONFIG_OS: '["ubuntu-latest"]' |
| 29 | +# Main Job |
| 30 | +jobs: |
| 31 | + config: |
| 32 | + runs-on: ubuntu-latest |
| 33 | + outputs: |
| 34 | + NODE_VERSION: ${{ steps.set-config.outputs.CONFIG_NODE_VERSION }} |
| 35 | + OS: ${{ steps.set-config.outputs.CONFIG_OS }} |
| 36 | + steps: |
| 37 | + - id: set-config |
| 38 | + run: | |
| 39 | + echo "CONFIG_NODE_VERSION=${{ toJSON(env.CONFIG_NODE_VERSION) }}" >> $GITHUB_OUTPUT |
| 40 | + echo "CONFIG_OS=${{ toJSON(env.CONFIG_OS) }}" >> $GITHUB_OUTPUT |
| 41 | + release: |
| 42 | + name: Test, Build and force Release |
| 43 | + needs: config |
| 44 | + |
| 45 | + runs-on: ${{ matrix.OS }} |
| 46 | + strategy: |
| 47 | + matrix: |
| 48 | + OS: ${{ fromJSON(needs.config.outputs.OS) }} |
| 49 | + NODE_VERSION: ${{ fromJSON(needs.config.outputs.NODE_VERSION) }} |
| 50 | + |
| 51 | + steps: |
| 52 | + - name: Checkout repo |
| 53 | + uses: actions/checkout@v4 |
| 54 | + - name: Setup Node.js ${{ matrix.NODE_VERSION }} |
| 55 | + uses: actions/setup-node@v4 |
| 56 | + with: |
| 57 | + node-version: ${{ matrix.NODE_VERSION }} |
| 58 | + - name: Commit trigger |
| 59 | + run: | |
| 60 | + git commit --allow-empty -m "${{ github.event.inputs.version }}: Trigger Manual Release |
| 61 | +
|
| 62 | + ${{ github.event.inputs.version }}:Forced Manual Release without code changes" |
| 63 | + - name: Install dependencies |
| 64 | + run: npm ci |
| 65 | + - name: Build Library |
| 66 | + run: npm run build --if-present |
| 67 | + - name: Run Tests |
| 68 | + run: npm test --if-present |
| 69 | + - name: Publish npm package |
| 70 | + uses: cycjimmy/semantic-release-action@v4 |
| 71 | + with: |
| 72 | + dry_run: ${{ github.event.inputs.dryRun == 'true' }} |
| 73 | + extra_plugins: | |
| 74 | + @semantic-release/changelog |
| 75 | + @semantic-release/git |
0 commit comments