2024-01-24 09:46:27 +00:00
|
|
|
name: Build an image to deploy website
|
|
|
|
|
|
|
|
on:
|
|
|
|
# Runs on pushes targeting the default branch
|
|
|
|
push:
|
|
|
|
branches: ["gitea-ci"]
|
|
|
|
|
|
|
|
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
|
|
|
|
permissions:
|
|
|
|
contents: read
|
|
|
|
pages: write
|
|
|
|
id-token: write
|
|
|
|
|
|
|
|
# Environment variables available to all jobs and steps in this workflow
|
|
|
|
env:
|
|
|
|
HUGO_ENV: production
|
|
|
|
HUGO_VERSION: "0.121.2"
|
|
|
|
GO_VERSION: "1.20.5"
|
|
|
|
NODE_VERSION: "18"
|
|
|
|
|
|
|
|
jobs:
|
|
|
|
# Build job
|
|
|
|
build:
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- name: Check out repository
|
|
|
|
uses: https://github.com/actions/checkout@v4
|
|
|
|
|
|
|
|
- name: Setup node
|
|
|
|
uses: https://github.com/actions/setup-node@v4
|
|
|
|
with:
|
|
|
|
node-version: '${{ NODE_VERSION }}'
|
|
|
|
|
|
|
|
- name: Setup Hugo
|
2024-01-24 09:49:16 +00:00
|
|
|
uses: https://github.com/peaceiris/actions-hugo@v2
|
2024-01-24 09:46:27 +00:00
|
|
|
with:
|
|
|
|
hugo-version: '${{ HUGO_VERSION }}'
|
|
|
|
|
|
|
|
# - name: Install Go
|
|
|
|
# run: |
|
|
|
|
# curl -LO "https://dl.google.com/go/go${{ env.GO_VERSION }}.linux-amd64.tar.gz"
|
|
|
|
# sudo tar -C /usr/local -xzf go${{ env.GO_VERSION }}.linux-amd64.tar.gz
|
|
|
|
# echo "export PATH=$PATH:/usr/local/go/bin" >> $GITHUB_ENV
|
|
|
|
# rm go${{ env.GO_VERSION }}.linux-amd64.tar.gz
|
|
|
|
# go version
|
|
|
|
#
|
|
|
|
- name: Setup Project
|
|
|
|
run: npm run project-setup
|
|
|
|
|
|
|
|
- name: Install npm dependencies
|
|
|
|
run: npm install
|
|
|
|
|
|
|
|
- name: Compile website
|
|
|
|
run: npm run build
|