CI #426
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: CI | |
env: | |
HUGO_ENV: production | |
NOTION_INTEGRATION_KEY: ${{ secrets.NOTION_INTEGRATION_KEY }} | |
NOTION_DATABASE_ID: ${{ secrets.NOTION_DATABASE_ID }} | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
on: | |
push: | |
branches: | |
- main # Set a branch to deploy | |
pull_request: | |
workflow_dispatch: | |
schedule: | |
- cron: '0 */24 * * *' | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
timeout-minutes: 15 | |
concurrency: | |
group: ${{ github.workflow }}-${{ github.ref }} | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
submodules: true # Fetch Hugo themes (true OR recursive) | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- name: Use Node.js 16.x | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16.x | |
cache: 'npm' | |
cache-dependency-path: '**/package-lock.json' | |
- name: Install Notion scrape dependencies | |
working-directory: notion | |
run: npm ci | |
- name: Fetch and convert Notion posts | |
working-directory: notion | |
run: node index.js | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v2 | |
with: | |
hugo-version: '0.91.2' | |
extended: true | |
- name: Build Hugo static site | |
run: hugo --config config.toml,config.production.toml -D --minify | |
- name: Setup Pages | |
uses: actions/configure-pages@v2 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v1 | |
with: | |
path: ./public | |
- name: Archive production artifacts | |
uses: actions/upload-artifact@v3 | |
with: | |
name: build | |
path: ./public | |
deploy-ftp: | |
if: ${{ false }} # disable for now | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
needs: build | |
steps: | |
- name: Download build artifact | |
uses: actions/download-artifact@v3 | |
- name: Deploy static site using FTP | |
uses: sebastianpopp/[email protected] | |
with: | |
host: ${{ secrets.FtpHost }} | |
user: ${{ secrets.FtpUser }} | |
password: ${{ secrets.FtpPassword }} | |
forceSsl: true | |
localDir: ./build | |
remoteDir: ${{ secrets.FtpRemoteDir }} | |
deploy-gh-pages: | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
needs: build | |
steps: | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v1 |