Refactor Hugo deploy workflow #14
@@ -1,4 +1,4 @@
|
||||
name: Deploy to Scaleway
|
||||
name: Build and Deploy Hugo
|
||||
|
||||
on:
|
||||
pull_request:
|
||||
@@ -7,57 +7,27 @@ on:
|
||||
- main
|
||||
|
||||
jobs:
|
||||
build-and-deploy:
|
||||
build_and_deploy:
|
||||
if: github.event.pull_request.merged == true
|
||||
runs-on: self-hosted
|
||||
|
||||
container:
|
||||
image: node:20-bookworm
|
||||
name: Deploy Hugo Website
|
||||
runs-on: ubuntu-latest
|
||||
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
uses: actions/checkout@v3
|
||||
with:
|
||||
submodules: recursive
|
||||
fetch-depth: 0
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2
|
||||
uses: peaceiris/actions-hugo@v2.6.0
|
||||
with:
|
||||
hugo-version: "latest"
|
||||
extended: true
|
||||
hugo-version: "0.108.0"
|
||||
|
||||
- name: Build Hugo site
|
||||
run: hugo --minify
|
||||
- name: Build site
|
||||
run: hugo
|
||||
|
||||
- name: Install AWS CLI
|
||||
run: |
|
||||
apt-get update
|
||||
apt-get install -y awscli
|
||||
|
||||
- name: Deploy to Object Storage
|
||||
run: |
|
||||
aws configure set default.s3.signature_version s3v4
|
||||
aws s3 sync public/ s3://notebook-arnodo-fr/ \
|
||||
--endpoint-url=https://s3.fr-par.scw.cloud \
|
||||
--region=fr-par \
|
||||
--delete
|
||||
- name: Deploy to S3
|
||||
run: hugo deploy --force --maxDeletes -1
|
||||
env:
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.SCW_ACCESS_KEY }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCW_SECRET_KEY }}
|
||||
AWS_DEFAULT_REGION: fr-par
|
||||
|
||||
- name: Install Scaleway CLI (for Purge only)
|
||||
run: |
|
||||
curl -s https://raw.githubusercontent.com/scaleway/scaleway-cli/master/scripts/get.sh | sh
|
||||
export PATH="$HOME/.scw/bin:$PATH"
|
||||
scw version
|
||||
|
||||
- name: Purge CDN Cache (optional)
|
||||
env:
|
||||
SCW_ACCESS_KEY: ${{ secrets.SCW_ACCESS_KEY }}
|
||||
SCW_SECRET_KEY: ${{ secrets.SCW_SECRET_KEY }}
|
||||
SCW_DEFAULT_REGION: fr-par
|
||||
run: |
|
||||
export PATH="$HOME/.scw/bin:$PATH"
|
||||
scw edge-services pipeline purge pipeline-id=${{ secrets.SCW_PIPELINE_ID }}
|
||||
AWS_ACCESS_KEY_ID: ${{ secrets.SCW_ACCESS_KEY_ID }}
|
||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCW_SECRET_ACCESS_KEY }}
|
||||
|
||||
Reference in New Issue
Block a user