OSDN Git Service

Initial github actions build
authorbillchenchina <billchenchina2001@gmail.com>
Wed, 27 Jan 2021 12:36:42 +0000 (20:36 +0800)
committerbillchenchina <billchenchina2001@gmail.com>
Wed, 27 Jan 2021 12:36:42 +0000 (20:36 +0800)
.github/workflows/build.yml [new file with mode: 0644]

diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml
new file mode 100644 (file)
index 0000000..1886549
--- /dev/null
@@ -0,0 +1,46 @@
+name: Build
+
+on:
+  push:
+    branches:
+      - master
+  pull_request:
+    branches:
+      - master
+
+jobs:
+  build:
+    name: OI-Wiki Page Build
+    runs-on: ubuntu-latest
+    steps:
+      - uses: actions/checkout@v2
+      - uses: actions/setup-python@v2
+        with:
+          python-version: '3.x'
+      - uses: actions/setup-node@v2
+        with:
+          node-version: '12'
+          check-latest: true
+      - name: Install Python dependencies
+        run: pip install -r requirements.txt
+      - name: Install Node.js dependencies
+        run: npm install .
+      - name: Page Build
+        run:
+          - chmod +x ./scripts/build.sh && ./scripts/build.sh
+          - mkdocs build -v
+      - name: Render math
+        run: node --max_old_space_size=3072 ./scripts/render_math.js
+      - name: Gulp minify
+        run: npx gulp minify
+      - name: Generate redirects
+        run: python scripts/gen_redirect.py
+      - name: Deploy to gh-pages
+        if: ${{ github.event_name == push }}
+        uses: peaceiris/actions-gh-pages@v3
+        with:
+          - github_token: ${{ secrets.GITHUB_TOKEN }}
+          - publish_dir: ./site
+      - name: BaiduPusher
+        if: ${{ github.event_name == push && env.BaiduToken }}
+        run: chmod +x scripts/BaiduPusher.sh && ./scripts/BaiduPusher.sh