2022-01-09 02:19:11 +00:00
|
|
|
name: Pages
|
|
|
|
|
|
|
|
on:
|
|
|
|
schedule:
|
|
|
|
- cron: "30 0,12 * * *"
|
|
|
|
workflow_dispatch:
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
pages:
|
|
|
|
runs-on: ubuntu-latest
|
2022-01-25 09:48:43 +00:00
|
|
|
container: node:lts-alpine
|
2022-01-09 02:19:11 +00:00
|
|
|
steps:
|
|
|
|
- uses: actions/checkout@v2
|
|
|
|
- name: Install Dependencies
|
2022-01-09 07:16:27 +00:00
|
|
|
run: |
|
|
|
|
apk update
|
|
|
|
apk add brotli curl git grep
|
2022-01-09 02:19:11 +00:00
|
|
|
- name: Build
|
2022-03-24 06:47:53 +00:00
|
|
|
run: |
|
|
|
|
npm install
|
|
|
|
npm run build
|
2022-01-09 07:16:27 +00:00
|
|
|
- name: Compress
|
|
|
|
run: |
|
|
|
|
find . -name "oisd*.txt" -type f -print0 | xargs -0 gzip -f -k -9
|
|
|
|
find . -name "oisd*.txt" -type f -print0 | xargs -0 brotli -f -k -9
|
2022-01-09 02:19:11 +00:00
|
|
|
- name: Deploy
|
|
|
|
uses: peaceiris/actions-gh-pages@v3
|
|
|
|
with:
|
|
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
publish_dir: ./public
|
|
|
|
force_orphan: true
|
2022-01-09 07:16:27 +00:00
|
|
|
- name: 'Upload Artifact'
|
|
|
|
uses: actions/upload-artifact@v2
|
|
|
|
with:
|
|
|
|
name: artifacts
|
|
|
|
path: ./tmp/
|
|
|
|
retention-days: 30
|
2022-01-25 09:48:43 +00:00
|
|
|
- name: Check GitLab Status
|
|
|
|
env:
|
|
|
|
GITHUB_ENV: ${{ env.GITHUB_ENV }}
|
|
|
|
run: sh ./src/gitlab_status.sh
|
|
|
|
- name: Cloudflare Pages
|
|
|
|
env:
|
|
|
|
CLOUDFLARE_BUILD_HOOK: ${{ secrets.CLOUDFLARE_BUILD_HOOK }}
|
|
|
|
if: ${{ env.CLOUDFLARE_BUILD_HOOK != 0 && env.GITLAB_STATUS == 'down' }}
|
|
|
|
run: curl -X POST "https://api.cloudflare.com/client/v4/pages/webhooks/deploy_hooks/${{ env.CLOUDFLARE_BUILD_HOOK }}"
|
|
|
|
- name: Netlify
|
|
|
|
env:
|
|
|
|
NETLIFY_SITE_ID: ${{ secrets.NETLIFY_SITE_ID }}
|
|
|
|
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
|
|
|
|
if: ${{ env.NETLIFY_SITE_ID != 0 && env.GITLAB_STATUS == 'down' }}
|
|
|
|
run: |
|
|
|
|
npm install netlify-cli -g
|
|
|
|
netlify --telemetry-disable
|
|
|
|
netlify deploy --dir=public --prod
|