refactor(actions): replicate gitlab ci
This commit is contained in:
parent
477b0c12b6
commit
12d3731466
|
@ -5,32 +5,34 @@ on:
|
||||||
branches:
|
branches:
|
||||||
- main
|
- main
|
||||||
schedule:
|
schedule:
|
||||||
- cron: "30 0,12 * * *"
|
- cron: "0 0,12 * * *"
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
pages:
|
pages:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
container: node:lts-alpine
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
- name: Use latest Node.js LTS
|
|
||||||
uses: actions/setup-node@v2
|
|
||||||
with:
|
|
||||||
node-version: 'lts/*'
|
|
||||||
- name: Cache NPM dependencies
|
|
||||||
uses: actions/cache@v2
|
|
||||||
with:
|
|
||||||
path: node_modules
|
|
||||||
key: ${{ runner.OS }}-npm-cache
|
|
||||||
restore-keys: |
|
|
||||||
${{ runner.OS }}-npm-cache
|
|
||||||
- name: Install Dependencies
|
- name: Install Dependencies
|
||||||
run: npm install
|
run: |
|
||||||
|
apk update
|
||||||
|
apk add brotli curl git grep
|
||||||
- name: Build
|
- name: Build
|
||||||
run: npm run build
|
run: sh src/script.sh
|
||||||
|
- name: Compress
|
||||||
|
run: |
|
||||||
|
find public -type f -regex '.*\.\(txt\|conf\|tpl\|rules\)$' -exec gzip -f -k -9 {} \;
|
||||||
|
find public -type f -regex '.*\.\(txt\|conf\|tpl\|rules\)$' -exec brotli -f -k -9 {} \;
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
uses: peaceiris/actions-gh-pages@v3
|
uses: peaceiris/actions-gh-pages@v3
|
||||||
with:
|
with:
|
||||||
github_token: ${{ secrets.GITHUB_TOKEN }}
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
||||||
publish_dir: ./public
|
publish_dir: ./public
|
||||||
force_orphan: true
|
force_orphan: true
|
||||||
|
- name: 'Upload Artifact'
|
||||||
|
uses: actions/upload-artifact@v2
|
||||||
|
with:
|
||||||
|
name: artifacts
|
||||||
|
path: ./tmp/
|
||||||
|
retention-days: 30
|
||||||
|
|
|
@ -1,5 +1,7 @@
|
||||||
#!/bin/sh
|
#!/bin/sh
|
||||||
|
|
||||||
|
# works best on busybox sh
|
||||||
|
|
||||||
set -efux -o pipefail
|
set -efux -o pipefail
|
||||||
|
|
||||||
mkdir -p "tmp/"
|
mkdir -p "tmp/"
|
||||||
|
|
Loading…
Reference in New Issue