Skip to content

Commit b7a9dcf

Browse files
committed
fix: [alpha] npm deployment version
1 parent 3b1af2a commit b7a9dcf

File tree

1 file changed

+24
-4
lines changed

1 file changed

+24
-4
lines changed

.github/workflows/production.yaml

+24-4
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,8 @@ on:
99
jobs:
1010
versioning:
1111
runs-on: ubuntu-latest
12+
outputs:
13+
commit_message: ${{ steps.capture_commit_message.outputs.commit_message }}
1214
steps:
1315
- uses: actions/checkout@v2
1416
with:
@@ -23,21 +25,32 @@ jobs:
2325
git config user.email "${GITHUB_ACTOR}@users.noreply.github.com"
2426
- name: Show Git Status
2527
run: git status
28+
- name: Capture Commit Message
29+
id: capture_commit_message
30+
run: echo "::set-output name=commit_message::$(git log -1 --pretty=%B)"
2631
- name: Release with release-it
2732
run: |
28-
commit_message="${{ github.event.head_commit.message }}"
33+
commit_message="${{ steps.capture_commit_message.outputs.commit_message }}"
2934
if [[ "$commit_message" == *"[alpha]"* ]]; then
3035
npx release-it minor --preRelease=alpha --ci
3136
else
3237
npx release-it --ci
3338
fi
3439
env:
3540
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41+
3642
deploy:
3743
needs: versioning
3844
runs-on: ubuntu-latest
3945
steps:
4046
- uses: actions/checkout@v2
47+
with:
48+
fetch-depth: 0
49+
- name: Fetch latest changes
50+
run: |
51+
git fetch --prune
52+
git checkout master
53+
git pull
4154
- name: Install Vercel CLI
4255
run: npm install --global vercel@latest
4356
- name: Pull Vercel Environment Information
@@ -46,12 +59,19 @@ jobs:
4659
run: vercel build --prod --token=${{ secrets.VERCEL_TOKEN }}
4760
- name: Deploy Project Artifacts to Vercel
4861
run: vercel deploy --prebuilt --prod --token=${{ secrets.VERCEL_TOKEN }}
62+
4963
release-npm:
5064
needs: deploy
5165
runs-on: ubuntu-latest
5266
steps:
53-
- uses: actions/checkout@v4
54-
# Setup .npmrc file to publish to npm
67+
- uses: actions/checkout@v2
68+
with:
69+
fetch-depth: 0
70+
- name: Fetch latest changes
71+
run: |
72+
git fetch --prune
73+
git checkout master
74+
git pull
5575
- uses: actions/setup-node@v3
5676
with:
5777
registry-url: 'https://registry.npmjs.org'
@@ -61,7 +81,7 @@ jobs:
6181
run: npm run build
6282
- name: Release
6383
run: |
64-
commit_message="${{ github.event.head_commit.message }}"
84+
commit_message="${{ needs.versioning.outputs.commit_message }}"
6585
if [[ "$commit_message" == *"[alpha]"* ]]; then
6686
cd dist/bundle && npm publish --tag alpha --access public --non-interactive
6787
else

0 commit comments

Comments
 (0)