Skip to content

Commit 0d2ec79

Browse files
authored
Merge pull request #93 from openameba/feature/maintenance-release-workflow
maintenance release workflow
2 parents c9806c7 + fc132a0 commit 0d2ec79

File tree

1 file changed

+24
-22
lines changed

1 file changed

+24
-22
lines changed

.github/workflows/release.yml

+24-22
Original file line numberDiff line numberDiff line change
@@ -15,39 +15,41 @@ jobs:
1515
releasing:
1616
name: releasing
1717
runs-on: ubuntu-latest
18+
permissions:
19+
contents: write
20+
id-token: write
21+
pull-requests: write
22+
timeout-minutes: 10
1823
steps:
1924
- uses: actions/checkout@v3
2025
with:
2126
fetch-depth: 0
22-
- uses: actions/setup-node@v2-beta
27+
- uses: actions/setup-node@v3
2328
with:
24-
node-version: 16
29+
node-version: 18
30+
cache: npm
31+
registry-url: 'https://registry.npmjs.org'
2532
- name: Set git user
2633
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'
3836
- name: Versioning
39-
run: npm version ${{ steps.extract_branch.outputs.version }}
37+
run: npm version "${GITHUB_REF##*/}"
4038
- name: Publish to npm
41-
run: npm publish
39+
run: npm publish --provenance
40+
env:
41+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
4242
- name: Push updates
4343
run: |
44-
git push origin ${{ steps.extract_branch.outputs.name }}
44+
git push origin ${{ github.ref_name }}
4545
git push origin --tags
4646
- name: Create Pull Request
4747
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

Comments
 (0)