Skip to content

Commit 9d0dda0

Browse files
committed
ci: Manual action to release to both NPM and github
1 parent c8ad80a commit 9d0dda0

File tree

2 files changed

+18
-51
lines changed

2 files changed

+18
-51
lines changed

.github/workflows/npm_publish.yml

Lines changed: 0 additions & 34 deletions
This file was deleted.
Lines changed: 18 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,8 @@
1-
name: Prepare release
2-
on:
3-
push:
4-
branches: ['main']
1+
name: Release
2+
on: workflow_dispatch
3+
54
jobs:
6-
prepare_release:
5+
release:
76
runs-on: ubuntu-latest
87
steps:
98
- name: Check out repository code
@@ -12,30 +11,32 @@ jobs:
1211
fetch-depth: 0
1312
ref: main
1413
token: ${{ secrets.GIT_ACCESS_TOKEN }}
15-
- name: Check if we already released
16-
run: |
17-
if git log -1 --pretty=%B | grep -qE "^chore\(release\)"; then
18-
echo "ALREADY_RELEASED=true" >> "$GITHUB_ENV"
19-
echo "Already released, other steps should cancel"
20-
fi
2114
- name: Deps
22-
if: env.ALREADY_RELEASED != 'true'
2315
run: npm ci
2416
- name: Tests
25-
if: env.ALREADY_RELEASED != 'true'
2617
run: npm run test:coverage
2718
- name: Generating coverage badges
28-
if: env.ALREADY_RELEASED != 'true'
2919
uses: jpb06/jest-badges-action@latest
3020
with:
3121
branches: main
3222
no-commit: true
3323
- name: Bump and changelog using commitizen
34-
if: env.ALREADY_RELEASED != 'true'
3524
run: |
3625
git add badges
37-
git config --local user.email "github-actions@github.com"
38-
git config --local user.name "github-actions"
26+
git config user.name "github-actions[bot]"
27+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
3928
npm run version:bump
4029
git push -f
4130
git push --tags
31+
- name: Publish to NPM
32+
run: npm publish
33+
env:
34+
NODE_AUTH_TOKEN: ${{secrets.npm_token}}
35+
- name: GitHub release
36+
uses: softprops/action-gh-release@v1
37+
with:
38+
draft: false
39+
body_path: CHANGELOG.md
40+
name: ${{ steps.version.outputs.version }}
41+
tag_name: ${{ github.ref }}
42+
token: ${{ github.token }}

0 commit comments

Comments
 (0)