Skip to content

Commit

Permalink
Update auto-build.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
forsaken628 committed Dec 28, 2023
1 parent d14a450 commit b1e8499
Showing 1 changed file with 43 additions and 24 deletions.
67 changes: 43 additions & 24 deletions .github/workflows/auto-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,30 @@ name: Github Action Auto Builder

on:
push:
branches:
- master
branches: [ "master" ]

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# 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@v1
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
Expand All @@ -27,7 +34,7 @@ jobs:
key: ${{ runner.os }}-node-${{ hashFiles('package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
- name: Cache API modules
uses: actions/cache@v1
id: cache-api
Expand All @@ -39,26 +46,39 @@ jobs:
- name: Install Dependencies
if: steps.cache.outputs.cache-hit != 'true'
run: npm install
run: npm install

- name: Install API Dependencies
if: steps.cache-api.outputs.cache-hit != 'true'
run: |
cd api
npm install
cd ..
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
npm run generate
cd api
npm run generate
cd ..
- name: Upload GitHub Pages artifact
uses: actions/upload-artifact@v4
with:
name: github-pages
path: public
retention-days: 1

deploy:
runs-on: ubuntu-latest

needs: [ build ]

steps:
- name: Download GitHub Pages artifact
uses: actions/download-artifact@v4
with:
name: docs
name: github-pages
path: public

- name: Init Repo and Commit
Expand All @@ -69,14 +89,13 @@ jobs:
git init
git add --all .
git commit -m "Github Action Auto Builder"
- name: Push Docs to Github Pages Repo
run: |
cd ./public
git push --quiet --force https://${{ secrets.GH_TOKEN }}@github.com/screeps-cn/screeps-cn.github.io.git master
git push --quiet --force https://${{ secrets.PAGES_TOKEN }}@github.com/screeps-cn/screeps-cn.github.io.git master
- 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

0 comments on commit b1e8499

Please sign in to comment.