Skip to content

Commit 23a42bd

Browse files
committed
chore: update release workflow with dry-run option
1 parent 52c9cc0 commit 23a42bd

File tree

2 files changed

+41
-123
lines changed

2 files changed

+41
-123
lines changed

.github/workflows/publish-dry-run.yml

Lines changed: 0 additions & 107 deletions
This file was deleted.

.github/workflows/publish-npm-latest.yml

Lines changed: 41 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,11 @@ name: 🏷️ Publish NPM Latest
33
on:
44
workflow_dispatch:
55
inputs:
6+
dryrun:
7+
type: boolean
8+
description: Dry-Run
69
graduate:
710
type: boolean
8-
required: false
911
description: Force Conventional Graduate
1012

1113
permissions:
@@ -74,20 +76,31 @@ jobs:
7476
demo/dist
7577
retention-days: 5
7678

77-
- name: Lerna Version (no graduate) 🏷️
78-
if: ${{ inputs.graduate == false }}
79-
env:
80-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
81-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
82-
NPM_CONFIG_PROVENANCE: true
79+
- name: Lerna Version (build query)
80+
shell: bash
8381
run: |
84-
git config --global user.name "${{ github.actor }}"
85-
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
86-
pnpm whoami
87-
pnpm exec lerna version --yes
88-
89-
- name: Lerna Version (force graduate) 🏷️
90-
if: ${{ inputs.graduate == true }}
82+
if ${{inputs.dryrun == true && inputs.graduate != true}}
83+
then
84+
echo "LERNA_VERSION_TYPE=🧪 Dry-Run" >> $GITHUB_ENV
85+
echo "LERNA_VERSION_QUERY=pnpm exec lerna version --yes --dry-run" >> $GITHUB_ENV
86+
elif ${{inputs.dryrun == true && inputs.graduate == true}}
87+
then
88+
echo "LERNA_VERSION_TYPE=🧪 Dry-Run w/Graduate" >> $GITHUB_ENV
89+
echo "LERNA_VERSION_QUERY=pnpm exec lerna version --yes --dry-run --conventional-graduate" >> $GITHUB_ENV
90+
elif ${{inputs.dryrun != true && inputs.graduate == true}}
91+
then
92+
echo "LERNA_VERSION_TYPE=🚀 Prod Version w/Graduate" >> $GITHUB_ENV
93+
echo "LERNA_VERSION_QUERY=pnpm exec lerna version --yes --conventional-graduate" >> $GITHUB_ENV
94+
elif ${{inputs.dryrun != true && inputs.graduate != true}}
95+
then
96+
echo "LERNA_VERSION_TYPE=🚀 Prod Version" >> $GITHUB_ENV
97+
echo "LERNA_VERSION_QUERY=pnpm exec lerna version --yes" >> $GITHUB_ENV
98+
fi
99+
100+
- name: Final version query type - ${{ env.LERNA_VERSION_TYPE }}
101+
run: echo "${{ env.LERNA_VERSION_QUERY }}"
102+
103+
- name: Lerna Version 🏷️
91104
env:
92105
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
93106
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
@@ -96,9 +109,10 @@ jobs:
96109
git config --global user.name "${{ github.actor }}"
97110
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
98111
pnpm whoami
99-
pnpm exec lerna version --conventional-commits --conventional-graduate --yes
112+
pnpm exec ${{ env.LERNA_VERSION_QUERY }}
100113
101114
- name: OTP
115+
if: ${{ inputs.dryrun != true }}
102116
uses: step-security/wait-for-secrets@v1
103117
id: wait-for-secrets
104118
with:
@@ -108,9 +122,20 @@ jobs:
108122
description: 'OTP from authenticator app'
109123
110124
- name: Lerna Publish 📦
125+
if: ${{ inputs.dryrun != true }}
111126
env:
112127
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
113128
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
114129
NPM_CONFIG_PROVENANCE: true
115130
run: |
116-
pnpm exec lerna publish from-package --force-publish --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}
131+
pnpm exec lerna publish from-package --force-publish --yes --otp ${{ steps.wait-for-secrets.outputs.OTP }}
132+
133+
- name: Build Website (GitHub demo site)
134+
run: pnpm build:demo
135+
136+
- name: Deploy to gh-pages
137+
if: github.ref == 'refs/heads/master'
138+
uses: peaceiris/actions-gh-pages@v3
139+
with:
140+
github_token: ${{ secrets.GITHUB_TOKEN }}
141+
publish_dir: ./demo/dist

0 commit comments

Comments
 (0)