Skip to content

Build and Publish

Build and Publish #2

name: Build and Publish
on:
schedule:
- cron: '0 0 * * *' # This will run the action daily at midnight.
workflow_dispatch: # This allows for manual triggering of the workflow.
jobs:
build-and-publish:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
env:
REPLICATE_API_TOKEN: ${{ secrets.REPLICATE_API_TOKEN }}
- name: Check for changes
run: |
git diff --quiet && exit 0 || echo "Changes detected!"
- name: Commit changes
run: |
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add -A
git commit -m "Build artifacts" || echo "No changes to commit"
git push
- name: Publish to npm
run: npx np minor --no-2fa --yolo
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}