build #217
This file contains hidden or 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 | |
on: | |
schedule: | |
- cron: '0 23 * * *' | |
workflow_dispatch: | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [20] | |
steps: | |
- name: Set variables | |
run: | | |
echo "BUILDTIME=$(TZ=Asia/Shanghai date +'%Y-%m-%d %H:%M')" >> $GITHUB_ENV | |
- uses: actions/checkout@v4 | |
- name: Install pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
version: 9 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'pnpm' | |
- name: Install dependencies | |
run: pnpm install | |
- name: Build | |
run: npx tsx ./tools/rulesets.ts | |
- name: Git push dist to "dist" branch | |
run: | | |
cd dist || exit 1 | |
git init | |
git config user.name 'github-actions[bot]' | |
git config user.email 'github-actions[bot]@users.noreply.github.com' | |
git checkout -b dist | |
git add . | |
git commit -m "Released on ${{ env.BUILDTIME }}" | |
git remote add origin "https://${{ github.actor }}:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}" | |
git push -f -u origin dist |