@@ -15,39 +15,41 @@ jobs:
15
15
releasing :
16
16
name : releasing
17
17
runs-on : ubuntu-latest
18
+ permissions :
19
+ contents : write
20
+ id-token : write
21
+ pull-requests : write
22
+ timeout-minutes : 10
18
23
steps :
19
24
- uses : actions/checkout@v3
20
25
with :
21
26
fetch-depth : 0
22
- - uses : actions/setup-node@v2-beta
27
+ - uses : actions/setup-node@v3
23
28
with :
24
- node-version : 16
29
+ node-version : 18
30
+ cache : npm
31
+ registry-url : ' https://registry.npmjs.org'
25
32
- name : Set git user
26
33
run : |
27
- git config --global user.email "<>"
28
- git config --global user.name "openameba"
29
- - name : Log in to npm
30
- run : |
31
- echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ~/.npmrc
32
- npm whoami
33
- - name : Extract branch from git ref
34
- run : |
35
- echo "::set-output name=name::${GITHUB_REF#refs/*/}"
36
- echo "::set-output name=version::${GITHUB_REF##*/}"
37
- id : extract_branch
34
+ git config --global user.name 'github-actions[bot]'
35
+ git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com'
38
36
- name : Versioning
39
- run : npm version ${{ steps.extract_branch.outputs.version }}
37
+ run : npm version "${GITHUB_REF##*/}"
40
38
- name : Publish to npm
41
- run : npm publish
39
+ run : npm publish --provenance
40
+ env :
41
+ NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
42
42
- name : Push updates
43
43
run : |
44
- git push origin ${{ steps.extract_branch.outputs.name }}
44
+ git push origin ${{ github.ref_name }}
45
45
git push origin --tags
46
46
- name : Create Pull Request
47
47
run : >
48
- curl
49
- -X POST
50
- -H "Accept: application/vnd.github.v3+json"
51
- -H "Authorization: token ${{ secrets.PERSONAL_ACCESS_TOKEN }}"
52
- https://api.github.com/repos/${{ github.event.repository.owner.name }}/${{ github.event.repository.name }}/pulls
53
- -d '{"head":"${{ steps.extract_branch.outputs.name }}","base":"${{ github.event.repository.default_branch }}","title":"chore(release): publish"}'
48
+ gh pr create
49
+ --assignee
50
+ --base "${{ github.event.repository.default_branch }}"
51
+ --body ''
52
+ --head "${{ github.ref_name }}"
53
+ --title "chore(release): publish"
54
+ env :
55
+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments