Skip to content

Commit ac63b3a

Browse files
vcua-mobifyvmarta
andauthored
Check if monorepo is a dev version before publishing to npm (#3210)
* Check if monorepo is a dev version before publishing to npm * Check env.IS_DEV_VERSION * test step * test * Apply suggestion * More test * test * test * test * use if block * test * test * use quiet mode * test * test * test * test * test * test * test * Try this regex that's perhaps more compatible * Re-enable other steps and clean up verification step --------- Co-authored-by: Vincent Marta <vmarta@salesforce.com>
1 parent 7bd6257 commit ac63b3a

File tree

1 file changed

+13
-7
lines changed

1 file changed

+13
-7
lines changed

.github/workflows/test.yml

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -87,8 +87,6 @@ jobs:
8787
- name: Run unit tests
8888
uses: "./.github/actions/unit_tests"
8989

90-
91-
9290
- name: Smoke test scripts
9391
if: env.IS_DEFAULT_NPM == 'true'
9492
uses: "./.github/actions/smoke_tests"
@@ -119,8 +117,20 @@ jobs:
119117
if: env.IS_NOT_FORK == 'true' && env.IS_DEFAULT_NPM == 'true'
120118
uses: "./.github/actions/check_clean"
121119

120+
- name: Check if monorepo version is a dev version
121+
run: |-
122+
version=`jq -r ".version" package.json`
123+
echo "The monorepo version is $version"
124+
if echo "$version" | grep -Eiq "[0-9]-dev(\.|$)"; then
125+
echo "Dev version detected."
126+
echo "IS_DEV_VERSION=true" >> "$GITHUB_ENV"
127+
else
128+
echo "Monorepo is not on a dev version."
129+
echo "IS_DEV_VERSION=false" >> "$GITHUB_ENV"
130+
fi
131+
122132
- name: Publish to NPM
123-
if: env.IS_NOT_FORK == 'true' && env.IS_MRT_NODE == 'true' && env.RELEASE == 'true'
133+
if: env.IS_NOT_FORK == 'true' && env.IS_MRT_NODE == 'true' && env.RELEASE == 'true' && env.IS_DEV_VERSION == 'false'
124134
uses: "./.github/actions/publish_to_npm"
125135
with:
126136
NODE_AUTH_TOKEN: ${{ secrets.NODE_AUTH_TOKEN }}
@@ -208,8 +218,6 @@ jobs:
208218
GENERATOR_PRESET: ${{ matrix.template }}
209219
timeout-minutes: 8
210220

211-
212-
213221
- name: Run unit tests
214222
if: env.IS_TEMPLATE_FROM_RETAIL_REACT_APP == 'true'
215223
uses: "./.github/actions/unit_tests"
@@ -303,8 +311,6 @@ jobs:
303311
GENERATOR_PRESET: ${{ matrix.template }}
304312
timeout-minutes: 7
305313

306-
307-
308314
- name: Run unit tests
309315
if: env.IS_TEMPLATE_FROM_RETAIL_REACT_APP == 'true'
310316
uses: "./.github/actions/unit_tests"

0 commit comments

Comments
 (0)