.github/workflows/auto-publish.yaml #160
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
on: | |
schedule: | |
- cron: '0 0 * * *' # Execute the job every day at 00:00 | |
jobs: | |
auto-publish: | |
permissions: | |
# Give the default GITHUB_TOKEN write permission to commit and push | |
contents: write | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
# Number of commits to fetch. 0 indicates all history for all branches and tags. | |
# Default: 1 | |
fetch-depth: 0 # Otherwise, you will failed to push refs to dest repo | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v2 | |
with: | |
run_install: false # For cache | |
# pnpm should be installed before the setup-node action. REF: https://github.com/actions/setup-node/issues/530 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version-file: '.nvmrc' | |
cache: pnpm | |
- name: Install Dependencies | |
run: pnpm install --silent --frozen-lockfile --ignore-scripts | |
env: | |
CI: true | |
- name: Auto Publish | |
run: | | |
git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
git config --global user.name "github-actions[bot]" | |
pnpm ts workflows/auto-publish.ts | |
env: | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |