2024-02-06 02:44:10 +00:00
|
|
|
name: Build
|
|
|
|
on:
|
|
|
|
push:
|
|
|
|
branches:
|
|
|
|
- main
|
|
|
|
jobs:
|
|
|
|
build:
|
|
|
|
env:
|
|
|
|
RUNNER_TOOL_CACHE: /toolcache
|
|
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
|
|
- run: git config --global core.quotepath false
|
|
|
|
- name: Install apt packages
|
|
|
|
run: apt update && apt install -y rsync
|
2024-12-12 06:50:44 +00:00
|
|
|
- uses: actions/setup-node@v4
|
2024-12-12 07:00:57 +00:00
|
|
|
node-version: 23
|
2024-12-12 06:50:44 +00:00
|
|
|
- uses: actions/checkout@v4
|
2024-02-06 02:44:10 +00:00
|
|
|
with:
|
|
|
|
fetch-depth: 0
|
|
|
|
- uses: https://github.com/actions/setup-go@v4
|
|
|
|
with:
|
2024-12-12 06:50:44 +00:00
|
|
|
go-version: '^1.23'
|
2024-02-06 02:44:10 +00:00
|
|
|
- name: Setup Hugo
|
|
|
|
uses: https://github.com/peaceiris/actions-hugo@v2
|
|
|
|
with:
|
2024-02-06 02:46:01 +00:00
|
|
|
hugo-version: "latest"
|
2024-02-06 02:44:10 +00:00
|
|
|
extended: true
|
2024-12-12 06:50:44 +00:00
|
|
|
- name: Setup Hugo modules
|
|
|
|
run: hugo mod get -u
|
|
|
|
- name: Setup Hugo npm modules
|
|
|
|
run: hugo mod npm pack
|
|
|
|
- run: npm install
|
2024-02-06 02:44:10 +00:00
|
|
|
- name: Run Hugo
|
2024-12-12 06:50:44 +00:00
|
|
|
run: hugo --gc --minify
|
2024-02-06 03:25:52 +00:00
|
|
|
# - name: upload artifacs
|
|
|
|
# uses: https://github.com/actions/upload-artifact@v3
|
|
|
|
# with:
|
|
|
|
# name: "test2"
|
|
|
|
# path: "public/**"
|
|
|
|
- name: Create private key
|
|
|
|
run: |
|
|
|
|
echo "${{ secrets.PRIVATE_KEY }}" > /tmp/act_runner_key
|
|
|
|
chmod 600 /tmp/act_runner_key
|
|
|
|
- name: rsync public directory
|
|
|
|
run: |
|
|
|
|
rsync -avz --delete -e "ssh -i /tmp/act_runner_key -o StrictHostKeyChecking=no -p ${{ vars.WEBSERVER_PORT }}" ${{ gitea.workspace }}/public/* ${{ vars.WEBSERVER_USER }}@${{ vars.WEBSERVER_HOST }}:/var/www/html
|