mirror of
https://github.com/by-jp/www.byjp.me.git
synced 2025-08-09 01:35:56 +01:00
91 lines
2.3 KiB
YAML
91 lines
2.3 KiB
YAML
name: Deploy Hugo site to Pages
|
|
|
|
on:
|
|
push:
|
|
branches: ["main"]
|
|
|
|
workflow_dispatch:
|
|
|
|
permissions:
|
|
contents: read
|
|
pages: write
|
|
id-token: write
|
|
|
|
concurrency:
|
|
group: "pages"
|
|
cancel-in-progress: true
|
|
|
|
defaults:
|
|
run:
|
|
shell: bash
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
env:
|
|
HUGO_VERSION: 0.111.3
|
|
steps:
|
|
- name: Install Hugo CLI
|
|
run: |
|
|
wget -O ${{ runner.temp }}/hugo.deb https://github.com/gohugoio/hugo/releases/download/v${HUGO_VERSION}/hugo_extended_${HUGO_VERSION}_linux-amd64.deb \
|
|
&& sudo dpkg -i ${{ runner.temp }}/hugo.deb
|
|
- name: Checkout
|
|
uses: actions/checkout@v3
|
|
with:
|
|
submodules: recursive
|
|
- name: Setup Pages
|
|
id: pages
|
|
uses: actions/configure-pages@v2
|
|
- name: Build with Hugo
|
|
env:
|
|
# For maximum backward compatibility with Hugo modules
|
|
HUGO_ENVIRONMENT: production
|
|
HUGO_ENV: production
|
|
run: |
|
|
hugo \
|
|
--minify
|
|
# Don't force a base URL, so relative links work everywhere
|
|
# --baseURL "${{ steps.pages.outputs.base_url }}/"
|
|
- name: Upload artifact
|
|
uses: actions/upload-pages-artifact@v1
|
|
with:
|
|
name: site
|
|
path: ./public
|
|
|
|
# Deployment job
|
|
deploy:
|
|
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
|
|
|
|
ipfs-publish:
|
|
runs-on: ubuntu-latest
|
|
needs: build
|
|
steps:
|
|
- uses: actions/download-artifact@v3
|
|
with:
|
|
name: site
|
|
path: ./public
|
|
- name: Publish to IPFS
|
|
id: Publish
|
|
uses: aquiladev/ipfs-action@master
|
|
with:
|
|
path: ./public
|
|
service: filebase
|
|
pinName: ${{ github.event.repository.name }}
|
|
filebaseBucket: microsites
|
|
filebaseKey: ${{ secrets.FILEBASE_KEY }}
|
|
filebaseSecret: ${{ secrets.FILEBASE_SECRET }}
|
|
- name: Update DNS record
|
|
uses: XueMoMo/actions-coudflare-dns@v1.0.1
|
|
with:
|
|
name: ${{ github.event.repository.name }}
|
|
cid: ${{ steps.Publish.outputs.cid }}
|
|
token: ${{ secrets.CLOUDFLARE_TOKEN }}
|
|
zone: ${{ secrets.CLOUDFLARE_ZONE_ID }}
|