1- name : Release & Publish to NPM
1+ name : Nightly Release & Publish to NPM
22
3- on : workflow_dispatch
3+ on :
4+ schedule :
5+ - cron : " 0 0 * * *" # every day at midnight UTC
6+ workflow_dispatch : # allow manual trigger
47
58jobs :
69 nightly :
@@ -12,21 +15,27 @@ jobs:
1215 - name : Setup
1316 uses : ./.github/actions/setup
1417
15- - name : Initialize Git user
16- shell : bash
17- run : |
18- git config user.name "github-actions"
19- git config user.email "mwlawlor@gmail.com"
20-
2118 - name : Setup NPM registry
2219 run : |
2320 npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN
2421 env :
2522 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
2623
27- - name : Run nightly release
24+ - name : Set nightly version
2825 run : |
29- yarn release:nightly --ci
26+ SHORT_SHA=$(git rev-parse --short HEAD)
27+ VERSION=0.0.0-nightly.$SHORT_SHA
28+ npm version $VERSION --no-git-tag-version
29+ echo "version=$VERSION" >> $GITHUB_ENV
30+
31+ - name : Check if version already exists
32+ run : |
33+ if npm view react-native-css@$version > /dev/null 2>&1; then
34+ echo "Version $version already exists. Skipping publish."
35+ exit 0
36+ fi
37+
38+ - name : Publish nightly
39+ run : npm publish --tag nightly
3040 env :
31- GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
3241 NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments