Merge pull request 'Refactor Hugo deploy workflow' (#14) from update-ci into main
Reviewed-on: #14
This commit was merged in pull request #14.
This commit is contained in:
@@ -1,4 +1,4 @@
|
|||||||
name: Deploy to Scaleway
|
name: Build and Deploy Hugo
|
||||||
|
|
||||||
on:
|
on:
|
||||||
pull_request:
|
pull_request:
|
||||||
@@ -7,57 +7,27 @@ on:
|
|||||||
- main
|
- main
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-and-deploy:
|
build_and_deploy:
|
||||||
if: github.event.pull_request.merged == true
|
if: github.event.pull_request.merged == true
|
||||||
runs-on: self-hosted
|
name: Deploy Hugo Website
|
||||||
|
runs-on: ubuntu-latest
|
||||||
container:
|
|
||||||
image: node:20-bookworm
|
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout code
|
- name: Checkout code
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v3
|
||||||
with:
|
with:
|
||||||
submodules: recursive
|
submodules: recursive
|
||||||
fetch-depth: 0
|
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2
|
uses: peaceiris/actions-hugo@v2.6.0
|
||||||
with:
|
with:
|
||||||
hugo-version: "latest"
|
hugo-version: "0.108.0"
|
||||||
extended: true
|
|
||||||
|
|
||||||
- name: Build Hugo site
|
- name: Build site
|
||||||
run: hugo --minify
|
run: hugo
|
||||||
|
|
||||||
- name: Install AWS CLI
|
- name: Deploy to S3
|
||||||
run: |
|
run: hugo deploy --force --maxDeletes -1
|
||||||
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
|
|
||||||
env:
|
env:
|
||||||
AWS_ACCESS_KEY_ID: ${{ secrets.SCW_ACCESS_KEY }}
|
AWS_ACCESS_KEY_ID: ${{ secrets.SCW_ACCESS_KEY_ID }}
|
||||||
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCW_SECRET_KEY }}
|
AWS_SECRET_ACCESS_KEY: ${{ secrets.SCW_SECRET_ACCESS_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 }}
|
|
||||||
|
|||||||
Reference in New Issue
Block a user