Skip to content

github pages

github pages #5314

Workflow file for this run

name: github pages
on:
push:
branches:
- main # Set a branch to deploy
schedule:
- cron: '0,30 8-10 * * *'
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up Go
uses: actions/setup-go@v2
with:
go-version: 1.17
- name: Cache
uses: actions/cache@v2
with:
path: |
~/.cache/go-build
~/go/pkg/mod
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }}
restore-keys: |
${{ runner.os }}-go-
- name: Copy Configuration
run: cp ./config.yaml.example ./config.yaml
- name: Build
run: go build
- name: Fetch latest
id: fetch_latest
run: |
echo "::set-output name=ERR_MSG::$(./news latest | grep -c 'error')"
- name: Cache pages
# if: ${{ steps.fetch_latest.outputs.ERR_MSG == 0 }}
run: ./news cache
- name: Update database
if: ${{ steps.fetch_latest.outputs.ERR_MSG == 0 }}
uses: test-room-7/action-update-file@v1
with:
file-path: data/news.db
committer-name: wenkechen
committer-email: ${{ secrets.COMMITTER_EMAIL }}
commit-msg: Update database
github-token: ${{ secrets.GITHUB_TOKEN }}
- name: Deploy
# if: ${{ steps.fetch_latest.outputs.ERR_MSG == 0 }}
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./cache