Skip to content

.github/workflows/auto-publish.yml #174

.github/workflows/auto-publish.yml

.github/workflows/auto-publish.yml #174

Workflow file for this run

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@v3
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: Read .nvmrc
id: nvmrc
run: echo "::set-output name=nvmrc::$(cat .nvmrc)"
- name: Use Node.js
uses: actions/setup-node@v2
with:
node-version: ${{ steps.nvmrc.outputs.nvmrc }}
- name: Get yarn cache
id: yarn-cache-dir
run: echo "::set-output name=dir::$(yarn cache dir)"
- uses: actions/cache@v1
with:
path: ${{ steps.yarn-cache-dir.outputs.dir }}
key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
restore-keys: |
${{ runner.os }}-yarn-
- name: Install Dependencies
run: yarn install --silent --frozen-lockfile --ignore-scripts --ignore-engines
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]"
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
node workflows/auto-publish.mjs
env:
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}