Add Forgejo Actions workflows for Hugo site
- Add build workflow for PR validation - Add deploy workflow for main branch S3 deployment - Use self-hosted runners 🤖 Generated with [Claude Code](https://claude.ai/code) Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
0265c44006
commit
9dbd1af5f9
2 changed files with 70 additions and 0 deletions
33
.forgejo/workflows/build.yml
Normal file
33
.forgejo/workflows/build.yml
Normal file
|
@ -0,0 +1,33 @@
|
||||||
|
name: Build Site
|
||||||
|
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
build:
|
||||||
|
runs-on: self-hosted
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Hugo
|
||||||
|
uses: peaceiris/actions-hugo@v3
|
||||||
|
with:
|
||||||
|
hugo-version: 'latest'
|
||||||
|
extended: true
|
||||||
|
|
||||||
|
- name: Build Hugo site
|
||||||
|
run: hugo --minify
|
||||||
|
|
||||||
|
- name: Upload build artifacts
|
||||||
|
uses: actions/upload-artifact@v4
|
||||||
|
with:
|
||||||
|
name: hugo-build
|
||||||
|
path: public/
|
||||||
|
retention-days: 7
|
37
.forgejo/workflows/deploy.yml
Normal file
37
.forgejo/workflows/deploy.yml
Normal file
|
@ -0,0 +1,37 @@
|
||||||
|
name: Deploy to S3
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- main
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
deploy:
|
||||||
|
runs-on: self-hosted
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v4
|
||||||
|
with:
|
||||||
|
submodules: recursive
|
||||||
|
fetch-depth: 0
|
||||||
|
|
||||||
|
- name: Setup Hugo
|
||||||
|
uses: peaceiris/actions-hugo@v3
|
||||||
|
with:
|
||||||
|
hugo-version: 'latest'
|
||||||
|
extended: true
|
||||||
|
|
||||||
|
- name: Build Hugo site
|
||||||
|
run: hugo --minify
|
||||||
|
|
||||||
|
- name: Configure AWS credentials
|
||||||
|
uses: aws-actions/configure-aws-credentials@v4
|
||||||
|
with:
|
||||||
|
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
|
||||||
|
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
|
||||||
|
aws-region: us-east-1
|
||||||
|
|
||||||
|
- name: Deploy to S3
|
||||||
|
run: |
|
||||||
|
aws s3 sync public/ s3://${{ secrets.S3_BUCKET_NAME }} --delete --no-cli-pager
|
Loading…
Add table
Add a link
Reference in a new issue