Skip to content

Publish nightly

Publish nightly #69

name: Publish nightly
on:
schedule:
- cron: '50 18 * * *'
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
include:
- branch: master
tag: dev
- branch: aiscript-next
tag: next
env:
NPM_SECRET: ${{ secrets.NPM_SECRET }}
steps:
- name: Checkout ${{ matrix.branch }}
uses: actions/checkout@v4.1.7
with:
ref: ${{ matrix.branch }}
- name: Setup Node.js
uses: actions/setup-node@v4.0.3
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: Set Version
run: |
CURRENT_VER=$(npm view 'file:.' version)
TIME_STAMP=$( date +'%Y%m%d' )
echo 'NEWVERSION='$CURRENT_VER-${{ matrix.tag }}.$TIME_STAMP >> $GITHUB_ENV
- name: Check Commits
run: |
echo 'LAST_COMMITS='$( git log --since '24 hours ago' | wc -c ) >> $GITHUB_ENV
- name: Prepare Publish
run: npm run pre-release
- name: Publish
uses: JS-DevTools/npm-publish@v3
if: ${{ env.NPM_SECRET != '' && env.LAST_COMMITS != 0 }}
with:
token: ${{ env.NPM_SECRET }}
tag: ${{ matrix.tag }}
access: public