Skip to content

Commit e0c1951

Browse files
committed
ci(release): add conventional-prerelease and dry-run support
1 parent 53bdf23 commit e0c1951

File tree

1 file changed

+34
-15
lines changed

1 file changed

+34
-15
lines changed

.github/workflows/release.yml

Lines changed: 34 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,6 @@ on:
66
dryrun:
77
type: boolean
88
description: Dry-Run
9-
graduate:
10-
type: boolean
11-
description: Force Conventional Graduate
129
tag:
1310
type: choice
1411
default: latest
@@ -73,20 +70,19 @@ jobs:
7370
- name: Lerna Version (build query)
7471
shell: bash
7572
run: |
76-
if ${{inputs.dryrun == true && inputs.graduate != true}}
73+
if ${{inputs.dryrun == true && (inputs.tag == 'alpha' || inputs.tag == 'beta' || inputs.tag == 'next')}}
74+
then
75+
echo "LERNA_VERSION_TYPE=🧪 Dry-Run w/Prerelease" >> $GITHUB_ENV
76+
echo "LERNA_VERSION_QUERY=lerna version --yes --conventional-prerelease --preid ${{ inputs.tag }} --dry-run" >> $GITHUB_ENV
77+
elif ${{inputs.dryrun == true}}
7778
then
7879
echo "LERNA_VERSION_TYPE=🧪 Dry-Run" >> $GITHUB_ENV
7980
echo "LERNA_VERSION_QUERY=lerna version --yes --dry-run" >> $GITHUB_ENV
80-
elif ${{inputs.dryrun == true && inputs.graduate == true}}
81-
then
82-
echo "LERNA_VERSION_TYPE=🧪 Dry-Run w/Graduate" >> $GITHUB_ENV
83-
echo "LERNA_VERSION_QUERY=lerna version --yes --dry-run --conventional-graduate" >> $GITHUB_ENV
84-
elif ${{inputs.dryrun != true && inputs.graduate == true}}
85-
then
86-
echo "LERNA_VERSION_TYPE=🚀 Prod Version w/Graduate" >> $GITHUB_ENV
87-
echo "LERNA_VERSION_QUERY=lerna version --yes --conventional-graduate" >> $GITHUB_ENV
88-
elif ${{inputs.dryrun != true && inputs.graduate != true}}
81+
elif ${{inputs.tag == 'alpha' || inputs.tag == 'beta' || inputs.tag == 'next'}}
8982
then
83+
echo "LERNA_VERSION_TYPE=🚀 Prod Version w/Prerelease" >> $GITHUB_ENV
84+
echo "LERNA_VERSION_QUERY=lerna version --yes --conventional-prerelease --preid ${{ inputs.tag }}" >> $GITHUB_ENV
85+
else
9086
echo "LERNA_VERSION_TYPE=🚀 Prod Version" >> $GITHUB_ENV
9187
echo "LERNA_VERSION_QUERY=lerna version --yes" >> $GITHUB_ENV
9288
fi
@@ -104,13 +100,36 @@ jobs:
104100
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
105101
pnpm exec ${{ env.LERNA_VERSION_QUERY }}
106102
103+
- name: Lerna Publish (build query)
104+
shell: bash
105+
run: |
106+
if ${{inputs.dryrun == true && (inputs.tag == 'alpha' || inputs.tag == 'beta' || inputs.tag == 'next')}}
107+
then
108+
echo "LERNA_PUBLISH_TYPE=🧪 Dry-Run w/Prerelease" >> $GITHUB_ENV
109+
echo "LERNA_PUBLISH_QUERY=lerna publish from-package --force-publish --yes --pre-dist-tag ${{ inputs.tag }} --dry-run" >> $GITHUB_ENV
110+
elif ${{inputs.dryrun == true}}
111+
then
112+
echo "LERNA_PUBLISH_TYPE=🧪 Dry-Run" >> $GITHUB_ENV
113+
echo "LERNA_PUBLISH_QUERY=lerna publish from-package --force-publish --yes --dist-tag latest --dry-run" >> $GITHUB_ENV
114+
elif [[ "${{ inputs.tag }}" == "alpha" || "${{ inputs.tag }}" == "beta" || "${{ inputs.tag }}" == "next" ]]
115+
then
116+
echo "LERNA_PUBLISH_TYPE=📦 Publish w/Prerelease" >> $GITHUB_ENV
117+
echo "LERNA_PUBLISH_QUERY=lerna publish from-package --force-publish --yes --pre-dist-tag ${{ inputs.tag }}" >> $GITHUB_ENV
118+
else
119+
echo "LERNA_PUBLISH_TYPE=📦 Publish Latest" >> $GITHUB_ENV
120+
echo "LERNA_PUBLISH_QUERY=lerna publish from-package --force-publish --yes --dist-tag latest" >> $GITHUB_ENV
121+
fi
122+
123+
- name: Final publish type → ${{ env.LERNA_PUBLISH_TYPE }}
124+
shell: bash
125+
run: echo "${{ env.LERNA_PUBLISH_QUERY }}"
126+
107127
- name: Lerna Publish 📦
108-
if: ${{ inputs.dryrun != true }}
109128
env:
110129
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
111130
shell: bash
112131
id: lerna-publish
113-
run: pnpm exec lerna publish from-package --force-publish --yes --dist-tag ${{ inputs.tag || 'latest' }}
132+
run: pnpm exec ${{ env.LERNA_PUBLISH_QUERY }}
114133

115134
- name: Website Dev Build
116135
run: pnpm build:dev

0 commit comments

Comments
 (0)