|
1 |
| -name: Release |
| 1 | +name: Manual NPM Publish |
2 | 2 |
|
3 | 3 | on:
|
4 |
| - push: |
5 |
| - tags: |
6 |
| - - 'v*' |
| 4 | + workflow_dispatch: |
| 5 | + inputs: |
| 6 | + releaseType: |
| 7 | + description: "Release type - major, minor or patch" |
| 8 | + required: true |
| 9 | + type: choice |
| 10 | + default: "patch" |
| 11 | + options: |
| 12 | + - patch |
| 13 | + - minor |
| 14 | + - major |
| 15 | + distTag: |
| 16 | + description: 'NPM tag (e.g. use "next" to release a test version)' |
| 17 | + required: true |
| 18 | + default: 'latest' |
| 19 | + preRelease: |
| 20 | + description: If latest release was a pre-release (e.g. X.X.X-alpha.0) and you want to push another one, pick "yes" |
| 21 | + required: true |
| 22 | + type: choice |
| 23 | + default: "no" |
| 24 | + options: |
| 25 | + - "yes" |
| 26 | + - "no" |
| 27 | + |
| 28 | +env: |
| 29 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 30 | + NPM_CONFIG_PROVENANCE: true |
7 | 31 |
|
8 | 32 | jobs:
|
9 | 33 | release:
|
10 | 34 | runs-on: ubuntu-latest
|
11 | 35 | permissions:
|
12 |
| - contents: write |
| 36 | + contents: write |
| 37 | + id-token: write |
13 | 38 | steps:
|
14 |
| - - uses: actions/checkout@v3 |
| 39 | + - uses: actions/checkout@v2 |
15 | 40 | with:
|
| 41 | + ref: 'main' |
16 | 42 | fetch-depth: 0
|
17 |
| - |
18 | 43 | - uses: actions/setup-node@v3
|
19 | 44 | with:
|
20 |
| - node-version: lts/* |
21 |
| - |
22 |
| - - run: npx changelogithub |
| 45 | + node-version: 18.x |
| 46 | + - name: Install Dependencies |
| 47 | + run: npm ci |
| 48 | + - name: Build |
| 49 | + run: npm run build |
| 50 | + - name: NPM Setup |
| 51 | + run: | |
| 52 | + npm set registry "https://registry.npmjs.org/" |
| 53 | + npm set //registry.npmjs.org/:_authToken $NPM_TOKEN |
| 54 | + npm whoami |
| 55 | + - name: Git Setup |
| 56 | + run: | |
| 57 | + git config --global user.email "git@bromann.dev" |
| 58 | + git config --global user.name "Christian Bromann" |
| 59 | + - name: Release |
| 60 | + run: npx release-it ${{github.event.inputs.releaseType}} --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir --npm.tag=${{github.event.inputs.distTag}} |
| 61 | + env: |
| 62 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 63 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 64 | + if: ${{ github.event.inputs.preRelease == 'no' }} |
| 65 | + - name: Pre-Release |
| 66 | + run: npx release-it ${{github.event.inputs.releaseType}} --github.release --ci --npm.skipChecks --no-git.requireCleanWorkingDir --preRelease=alpha --github.preRelease --npm.tag=next |
23 | 67 | env:
|
24 |
| - GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}} |
| 68 | + NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 69 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 70 | + if: ${{ github.event.inputs.preRelease == 'yes' }} |
0 commit comments