Skip to content

Publish nightly

Publish nightly #75

name: Publish nightly
on:
schedule:
- cron: '50 18 * * *'
workflow_dispatch:
jobs:
get-branches:
runs-on: ubuntu-latest
outputs:
branches: ${{ steps.getb.outputs.branches }}
steps:
- id: getb
run: |
branches=[$(git branch -r | grep origin | grep -v '\->' | sed 's/\s*origin\///' | sed 's/^.*$/"&",/')]
echo "branches=$branches" >> $GITHUB_OUTPUT
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 }}
needs: get-branches
if: contains(fromJSON(needs.get-branches.outputs.branches), matrix.branch)

Check failure on line 33 in .github/workflows/publish-nightly.yml

View workflow run for this annotation

GitHub Actions / Publish nightly

Invalid workflow file

The workflow is not valid. .github/workflows/publish-nightly.yml (Line: 33, Col: 9): Unrecognized named-value: 'matrix'. Located at position 57 within expression: contains(fromJSON(needs.get-branches.outputs.branches), matrix.branch)
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