Merge pull request #222 from zetxek/update-submodules/update-20241125… #363
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: Build Hugo | |
on: | |
push: | |
branches: | |
- main | |
- develop | |
- feature/github-actions | |
- '*' | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
submodules: true # Fetch Hugo themes | |
fetch-depth: 0 # Fetch all history for .GitInfo and .Lastmod | |
- uses: actions/setup-node@v4 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Install postcss | |
run: npm install postcss-cli | |
- name: Setup Hugo | |
uses: peaceiris/actions-hugo@v3 | |
with: | |
hugo-version: '0.136.2' | |
extended: true | |
- name: Build | |
run: hugo --minify --buildDrafts=true | |
- name: Set up Python 3.8 | |
uses: actions/setup-python@v5 | |
with: | |
python-version: 3.8 | |
- name: Upload to S3 | |
uses: actions/upload-artifact@v4 | |
with: | |
name: build | |
path: public | |
- uses: jakejarvis/s3-sync-action@master | |
with: | |
args: --acl public-read --follow-symlinks --delete | |
env: | |
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_REGION: 'eu-central-1' # optional: defaults to us-east-1 | |
SOURCE_DIR: 'public' # optional: defaults to entire repository | |
- name: Deploy to GH Pages | |
uses: peaceiris/actions-gh-pages@v4 | |
with: | |
github_token: ${{ secrets.GITHUB_TOKEN }} | |
publish_dir: ./public |