Skip to content

npm generate

npm generate #27

Workflow file for this run

name: npm generate
on:
push:
branches: "main"
paths-ignore:
- README.md
- LICENSE
- .gitignore
- .github/**
- "!.github/workflows/npm-generate.yml"
schedule:
- cron: "41 */6 * * *"
workflow_dispatch:
concurrency: ${{ github.workflow }}
jobs:
npm-generate:
permissions:
contents: write
outputs:
pushed: ${{ steps.add-commit-push.outputs.pushed }}
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: npm
- run: npm ci
- run: npm run generate
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: npm test
- id: add-commit-push
run: |
git config --global user.name "actions[bot]"
git config --global user.email "actions@github.com"
git add -A
if git commit -m "Automated changes"; then
git push -u origin main
echo "pushed=true" >> "$GITHUB_OUTPUT"
else
echo "pushed=false" >> "$GITHUB_OUTPUT"
fi
gh-release-create:
needs: npm-generate
if: fromJSON(needs.npm-generate.outputs.pushed)
permissions:
contents: write
runs-on: windows-latest
defaults:
run:
shell: bash
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: "lts/*"
cache: npm
- run: |
version=$(jq -r .version package.json)
gh release create "v$version" --generate-notes
env:
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
npm-publish:
needs: gh-release-create
uses: ./.github/workflows/npm-publish.yml
secrets: inherit