Publish nightly (dev) #115
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish nightly (dev) | |
on: | |
schedule: | |
- cron: '50 18 * * *' | |
workflow_dispatch: | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
env: | |
NPM_SECRET: ${{ secrets.NPM_SECRET }} | |
BRANCH: master | |
TAG: dev | |
steps: | |
- name: Checkout | |
uses: actions/[email protected] | |
with: | |
ref: ${{ env.BRANCH }} | |
- name: Setup Node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 20.x | |
- name: Cache dependencies | |
uses: actions/cache@v4 | |
with: | |
path: ~/.npm | |
key: npm-${{ hashFiles('package-lock.json') }} | |
restore-keys: npm- | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Set Version | |
run: | | |
TIME_STAMP=$( date +'%Y%m%d' ) | |
VERSION_SUFFIX=-$TAG.$TIME_STAMP | |
vim package.json '+/"version"' '+s/:\s*".*\zs\ze"/'$VERSION_SUFFIX/ '+wq' | |
- name: Check Commits | |
run: | | |
echo 'LAST_COMMITS='$( git log --since '24 hours ago' | wc -c ) >> $GITHUB_ENV | |
- name: Publish | |
uses: JS-DevTools/npm-publish@v3 | |
if: ${{ env.NPM_SECRET != '' && env.LAST_COMMITS != 0 }} | |
with: | |
token: ${{ env.NPM_SECRET }} | |
tag: ${{ env.TAG }} | |
access: public |