Skip to content

Commit 6c76c33

Browse files
committed
fix npm deployments tag [alpha]
1 parent 30b47d7 commit 6c76c33

File tree

2 files changed

+67
-50
lines changed

2 files changed

+67
-50
lines changed

.github/workflows/production.yaml

+51-32
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release & Production Deployment
1+
name: Vercel Production Deployment
22
env:
33
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }}
44
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }}
@@ -7,38 +7,34 @@ on:
77
branches:
88
- master
99
jobs:
10-
release:
11-
runs-on: ubuntu-latest
12-
steps:
13-
- uses: actions/checkout@v2
14-
with:
15-
fetch-depth: 0
16-
- name: Setup Node.js
17-
uses: actions/setup-node@v3
18-
with:
19-
registry-url: "https://registry.npmjs.org"
20-
- name: Install dependencies
21-
run: npm install
22-
- name: Setup Git user
23-
run: |
24-
git config user.name "${GITHUB_ACTOR}"
25-
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
26-
- name: Show Git Status
27-
run: git status
28-
- name: Release with release-it
29-
run: |
30-
commit_message="${{ github.event.head_commit.message }}"
31-
if [[ "$commit_message" == *"[alpha]"* ]]; then
32-
npx release-it minor --preRelease=alpha --ci
33-
elif [[ "$commit_message" == *"[major-alpha]"* ]]; then
34-
npx release-it major --preRelease=alpha --ci
35-
else
36-
npx release-it --ci
37-
fi
38-
env:
39-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
40-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
10+
versioning:
11+
runs-on: ubuntu-latest
12+
steps:
13+
- uses: actions/checkout@v2
14+
with:
15+
fetch-depth: 0
16+
- name: Setup Node.js
17+
uses: actions/setup-node@v3
18+
- name: Install dependencies
19+
run: npm install
20+
- name: Setup Git user
21+
run: |
22+
git config user.name "${GITHUB_ACTOR}"
23+
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
24+
- name: Show Git Status
25+
run: git status
26+
- name: Release with release-it
27+
run: |
28+
commit_message="${{ github.event.head_commit.message }}"
29+
if [[ "$commit_message" == *"[alpha]"* ]]; then
30+
npx release-it minor --preRelease=alpha --ci
31+
else
32+
npx release-it --ci
33+
fi
34+
env:
35+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4136
deploy:
37+
needs: versioning
4238
runs-on: ubuntu-latest
4339
steps:
4440
- uses: actions/checkout@v2
@@ -50,3 +46,26 @@ jobs:
5046
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
5147
- name: Deploy Project Artifacts to Vercel
5248
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
49+
release-npm:
50+
needs: deploy
51+
runs-on: ubuntu-latest
52+
steps:
53+
- uses: actions/checkout@v4
54+
# Setup .npmrc file to publish to npm
55+
- uses: actions/setup-node@v3
56+
with:
57+
registry-url: 'https://registry.npmjs.org'
58+
- name: Install Deps
59+
run: npm install
60+
- name: Build
61+
run: npm run build
62+
- name: Release
63+
run: |
64+
commit_message="${{ github.event.head_commit.message }}"
65+
if [[ "$commit_message" == *"[alpha]"* ]]; then
66+
cd dist/bundle && npm publish --tag alpha --access public --non-interactive
67+
else
68+
cd dist/bundle && npm publish --access public --non-interactive
69+
fi
70+
env:
71+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

.release-it.json

+16-18
Original file line numberDiff line numberDiff line change
@@ -1,21 +1,19 @@
11
{
2-
"git": {
3-
"commit": true,
4-
"commitMessage": "chore: release v${version}",
5-
"tag": true,
6-
"tagName": "v${version}",
7-
"push": true
8-
},
9-
"npm": {
10-
"publish": false
11-
},
12-
"plugins": {
13-
"@release-it/conventional-changelog": {
14-
"preset": "angular",
15-
"infile": "CHANGELOG.md"
2+
"git": {
3+
"commit": true,
4+
"commitMessage": "chore: release v${version}",
5+
"tag": true,
6+
"tagName": "v${version}",
7+
"push": true
8+
},
9+
"npm": {
10+
"publish": false
11+
},
12+
"plugins": {
13+
"@release-it/conventional-changelog": {
14+
"preset": "angular",
15+
"infile": "CHANGELOG.md"
16+
}
1617
}
17-
},
18-
"hooks": {
19-
"after:bump": "npm run release"
2018
}
21-
}
19+

0 commit comments

Comments
 (0)