|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - "main" |
| 7 | + release: |
| 8 | + type: [ created ] |
7 | 9 |
|
8 | 10 | jobs: |
9 | 11 | build: |
@@ -36,44 +38,30 @@ jobs: |
36 | 38 | branch: docs |
37 | 39 | folder: showcase/build |
38 | 40 | single-commit: true |
39 | | -# |
40 | | -# build-library: |
41 | | -# needs: install-and-test |
42 | | -# runs-on: ubuntu-latest |
43 | | -# defaults: |
44 | | -# run: |
45 | | -# working-directory: 'library' |
46 | | -# name: "Bump version and create changelog with commitizen" |
47 | | -# steps: |
48 | | -# - name: Check out |
49 | | -# uses: actions/checkout@v3 |
50 | | -# with: |
51 | | -# fetch-depth: 0 |
52 | | -# token: "${{ secrets.GITHUB_TOKEN }}" |
53 | | -# - id: cz |
54 | | -# name: Bump package |
55 | | -# uses: commitizen-tools/commitizen-action@master |
56 | | -# with: |
57 | | -# github_token: ${{ secrets.GITHUB_TOKEN }} |
58 | | -# - name: Print Version |
59 | | -# run: echo "Bumped to version ${{ steps.cz.outputs.version }}" |
60 | | -# - name: Build library |
61 | | -# run: npm ci build |
62 | 41 |
|
63 | | -# publish-gpr: |
64 | | -# needs: tag-and-bump |
65 | | -# runs-on: ubuntu-latest |
66 | | -# defaults: |
67 | | -# run: |
68 | | -# working-directory: 'library' |
69 | | -# steps: |
70 | | -# - uses: actions/checkout@v3 |
71 | | -# - uses: actions/setup-node@v3 |
72 | | -# with: |
73 | | -# node-version: '19.x' |
74 | | -# registry-url: 'https://registry.npmjs.org' |
75 | | -# |
76 | | -# - name: Publish to npmjs |
77 | | -# run: npm publish --access public |
78 | | -# env: |
79 | | -# NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}} |
| 42 | + publish: |
| 43 | + needs: build |
| 44 | + if: ${{ github.event_name == 'release' }} |
| 45 | + runs-on: ubuntu-latest |
| 46 | + defaults: |
| 47 | + run: |
| 48 | + working-directory: 'library' |
| 49 | + steps: |
| 50 | + - uses: actions/checkout@v3 |
| 51 | + - uses: actions/setup-node@v3 |
| 52 | + with: |
| 53 | + node-version: '19.x' |
| 54 | + registry-url: 'https://registry.npmjs.org' |
| 55 | + |
| 56 | + - name: Get release version |
| 57 | + id: release |
| 58 | + run: | |
| 59 | + FULL_VERSION=${{ github.event.release.tag_name }} |
| 60 | + SHORT_VERSION=${FULL_VERSION:1} |
| 61 | + echo shortVersion=${SHORT_VERSION} >> $GITHUB_OUTPUT |
| 62 | +
|
| 63 | + - name: Publish to npmjs |
| 64 | + working-directory: ./library |
| 65 | + run: npm publish --access public --tag ${{ steps.release.outputs.shortVersion }} |
| 66 | + env: |
| 67 | + NODE_AUTH_TOKEN: ${{secrets.NPM_PUBLISH_TOKEN}} |
0 commit comments