Skip to content

Workflow file for this run

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
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: Upload GitHub Pages artifact
uses: actions/upload-pages-artifact@v3.0.0
with:
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: 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
deploy:
runs-on: ubuntu-latest
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
needs: [ build ]
steps:
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4