|
9 | 9 | branches: [main] |
10 | 10 | pull_request: |
11 | 11 | branches: [main] |
| 12 | + workflow_dispatch: |
| 13 | + inputs: |
| 14 | + release-type: |
| 15 | + description: 'Type of release (major, minor, patch, alpha)' |
| 16 | + required: true |
| 17 | + default: patch |
| 18 | + type: choice |
| 19 | + options: |
| 20 | + - major |
| 21 | + - minor |
| 22 | + - patch |
| 23 | + - alpha |
12 | 24 |
|
13 | 25 | jobs: |
14 | 26 | continous-integration: |
@@ -64,22 +76,34 @@ jobs: |
64 | 76 | - name: Build library |
65 | 77 | run: pnpm build |
66 | 78 |
|
67 | | - - name: Set NPM config |
68 | | - if: | |
69 | | - github.event_name == 'release' || |
70 | | - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-javascript-wrapper == 'true') |
71 | | - run: | |
72 | | - echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" >> .npmrc |
73 | | - echo "registry=https://registry.npmjs.org/" >> .npmrc |
74 | | - echo "always-auth=true" >> .npmrc |
75 | | -
|
76 | | - - name: Publish JavaScript Wrapper |
77 | | - if: | |
78 | | - github.event_name == 'release' || |
79 | | - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-javascript-wrapper == 'true') |
| 79 | + - name: Set the NPM config |
| 80 | + env: |
| 81 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
| 82 | + run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN |
| 83 | + |
| 84 | + - name: Publish |
| 85 | + id: publish |
| 86 | + env: |
| 87 | + GH_TOKEN: ${{ secrets.GH_TOKEN }} |
| 88 | + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |
80 | 89 | run: | |
81 | | - if [[ $(cat lerna.json | grep version | head -1 | grep dev) ]]; then |
82 | | - npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version --dist-tag=alpha |
83 | | - else |
84 | | - npx lerna publish from-package --no-push --no-private --yes --no-git-tag-version |
85 | | - fi |
| 90 | + echo ${{ inputs.release-type }} |
| 91 | + git config --global user.name "Openwallet Foundation" |
| 92 | +
|
| 93 | + if [ ${{ inputs.release-type }} == 'alpha' ]; then |
| 94 | + pnpm release --pre-dist-tag alpha prerelease --yes |
| 95 | + else |
| 96 | + pnpm release ${{ inputs.release-type }} --force-publish --no-private --yes |
| 97 | + fi |
| 98 | +
|
| 99 | + version=$(node -p "require('./lerna.json').version") |
| 100 | + echo "LERNA_VERSION=$version" >> "$GITHUB_OUTPUT" |
| 101 | +
|
| 102 | + - name: Create Github Release |
| 103 | + uses: softprops/action-gh-release@v1 |
| 104 | + with: |
| 105 | + generate_release_notes: true |
| 106 | + prerelease: ${{ inputs.release-type == 'alpha' }} |
| 107 | + token: ${{ secrets.GH_TOKEN }} |
| 108 | + tag_name: v${{ steps.publish.outputs.LERNA_VERSION }} |
| 109 | + name: Release v${{ steps.publish.outputs.LERNA_VERSION }} |
0 commit comments