Build & Deploy #2588
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
name: Build & Deploy | |
on: | |
push: | |
# branches: | |
# - master | |
tags: | |
- v* | |
schedule: | |
# 每天 5:30 和 17:30 UTC 触发工作流程 | |
- cron: '30 5,17 * * *' | |
jobs: | |
build-deploy: | |
env: | |
ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }} | |
ID: ${{ secrets.GITHUB_ID }} | |
SECRET: ${{ secrets.GITHUB_SECRET }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 20 | |
registry-url: 'https://registry.npmjs.org' | |
- run: npm install | |
- name: Modify Version(Date) | |
shell: bash | |
run: | | |
node -e 'var pkg = require("./package.json"); pkg.version= (new Date().getFullYear().toString().substr(2)) + "." + (new Date().getMonth() + 1) + "." + (new Date().getDate()); require("fs").writeFileSync("./package.json", JSON.stringify(pkg, null, 2))' | |
- run: npm run get:trending | |
- run: npm run get:repos | |
- run: npm run get:users | |
- run: npm run get:users:china | |
- run: cat .cache/users.json | |
- run: cat .cache/users.china.json | |
- run: npm run get:users:info | |
- run: npm run start | |
- run: mkdir -p web/data | |
- run: cp -rf dist/* web/data | |
- name: Generate Contributors Images | |
uses: jaywcjlove/github-action-contributors@main | |
with: | |
filter-author: (renovate\[bot\]|renovate-bot|dependabot\[bot\]) | |
output: web/CONTRIBUTORS.svg | |
avatarSize: 42 | |
- name: Deploy | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./web | |
user_name: github-actions[bot] | |
user_email: github-actions[bot]@users.noreply.github.com | |
- name: Modify README.md | |
uses: jaywcjlove/github-action-modify-file-content@main | |
with: | |
path: README.md | |
body: "{{date:YYYY-MM-DD HH:mm:ss}}" | |
branch: master | |
- run: npm publish --access public | |
continue-on-error: true | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |