15
15
- patch
16
16
default : minor
17
17
jobs :
18
- release :
18
+ bump-version :
19
19
runs-on : ubuntu-latest
20
+
21
+ outputs :
22
+ RELEASE_VERSION : ${{ steps.create_tags.outputs.RELEASE_VERSION }}
20
23
permissions :
21
24
contents : write
25
+
22
26
steps :
23
27
- uses : actions/checkout@v3
24
28
28
32
29
33
- run : npm ci
30
34
31
- - name : npm version...
35
+ - name : Bump version and regenerate README
32
36
run : |
33
37
# https://github.com/orgs/community/discussions/26560
34
38
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
@@ -37,11 +41,22 @@ jobs:
37
41
npx oclif readme && node src/format-readme.js
38
42
git commit -am "Release for ${VERSION}"
39
43
git tag $VERSION
40
- echo "VERSION =${VERSION}" >> $GITHUB_ENV
44
+ echo "RELEASE_VERSION =${VERSION}" >> $GITHUB_OUTPUT
41
45
echo "Released version ${VERSION}" >> $GITHUB_STEP_SUMMARY
46
+ id : create_tags
42
47
43
48
- run : git push origin --follow-tags
44
-
49
+
50
+ publish-github :
51
+ runs-on : ubuntu-latest
52
+
53
+ needs : bump-version
54
+ permissions :
55
+ contents : write
56
+ env :
57
+ VERSION : ${{ needs.bump-version.outputs.RELEASE_VERSION }}
58
+
59
+ steps :
45
60
- name : Create GitHub Release
46
61
uses : octokit/request-action@v2.x
47
62
id : create_release
54
69
generate_release_notes : true
55
70
env :
56
71
GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
72
+
73
+ publish-npm :
74
+ runs-on : ubuntu-latest
75
+
76
+ needs : [bump-version, publish-github]
77
+ env :
78
+ VERSION : ${{ needs.bump-version.outputs.RELEASE_VERSION }}
79
+
80
+ steps :
81
+ - uses : actions/checkout@v3
82
+
83
+ # Setup .npmrc file to publish to npm
84
+ - uses : actions/setup-node@v3
85
+ with :
86
+ node-version : ' 18.x'
87
+ registry-url : ' https://registry.npmjs.org'
88
+
89
+ - run : npm ci
90
+
91
+ - run : npm publish
92
+ env :
93
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments