update #32
Workflow file for this run
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: Github Action Auto Builder | |
on: | |
push: | |
branches: [ "fix_pages" ] | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
# Allow only one concurrent deployment, skipping runs queued between the run in-progress and latest queued. | |
# However, do NOT cancel in-progress runs as we want to allow these production deployments to complete. | |
concurrency: | |
group: "pages" | |
cancel-in-progress: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Use Node.js 10.x | |
uses: actions/setup-node@v1 | |
with: | |
node-version: 10.x | |
- name: Cache node modules | |
uses: actions/cache@v1 | |
id: cache | |
with: | |
path: node_modules | |
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node- | |
- name: Cache API modules | |
uses: actions/cache@v1 | |
id: cache-api | |
with: | |
path: api/node_modules | |
key: ${{ runner.os }}-node-api-${{ hashFiles('api/package-lock.json') }} | |
restore-keys: | | |
${{ runner.os }}-node-api- | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Install API Dependencies | |
if: steps.cache-api.outputs.cache-hit != 'true' | |
run: | | |
cd api | |
npm install | |
cd .. | |
- name: Generate Docs | |
run: | | |
npm run generate | |
cd api | |
npm run generate | |
cd .. | |
- name: Update Artifact | |
uses: actions/upload-artifact@v1 | |
with: | |
name: docs | |
path: public | |
- name: Init Repo and Commit | |
run: | | |
cd ./public | |
git config --global user.email "nobody@github.com" | |
git config --global user.name "Github Action Auto Builder" | |
git init | |
git add --all . | |
git commit -m "Github Action Auto Builder" | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Deploy to GitHub Pages | |
uses: actions/deploy-pages@v4 | |
with: | |
artifact_name: docs | |
- name: Push Docs to Gitee Pages Repo | |
run: | | |
cd ./public | |
git push --quiet --force https://LokiSharp:${{ secrets.GITEE_TOKEN }}@gitee.com/screeps-cn/screeps-cn.git master |