From 184608d852e3a2252320d579b785c34bfcebc5d2 Mon Sep 17 00:00:00 2001 From: Thomas Schwery Date: Sun, 10 Apr 2022 22:04:34 +0200 Subject: [PATCH] ci: Use Netlify --- .gitignore | 5 ++ .gitlab-ci.yml | 54 ++++--------------- config.toml | 2 +- themes/hugo-recettes/layouts/index.rss.xml | 2 +- .../layouts/partials/navbox.html | 5 +- 5 files changed, 19 insertions(+), 49 deletions(-) diff --git a/.gitignore b/.gitignore index a862b91..4b1f55a 100644 --- a/.gitignore +++ b/.gitignore @@ -2,3 +2,8 @@ /public/ /resources/ +# Local Netlify folder +.netlify + +.hugo_build.lock +hugo diff --git a/.gitlab-ci.yml b/.gitlab-ci.yml index c5a93cb..3f06459 100644 --- a/.gitlab-ci.yml +++ b/.gitlab-ci.yml @@ -1,64 +1,32 @@ variables: - S3_BUCKET_NAME: recettes.inf3.ch - AWS_BUCKET_REGION: us-east-1 + NETLIFY_SITE: recettes-4f3ee + HUGO_ENV: production -gohugo-build-branch: - image: monachus/hugo:v0.63.1 - script: - - hugo -b http://${S3_BUCKET_NAME}.s3-website-${AWS_BUCKET_REGION}.amazonaws.com/${CI_COMMIT_REF_SLUG} - artifacts: - expire_in: 1 week - paths: - - public - except: - - /^master$/ - -gohugo-build-master: - image: monachus/hugo:v0.63.1 +gohugo-build: + image: klakegg/hugo:0.95.0-debian script: - hugo artifacts: expire_in: 1 week paths: - public - only: - - /^master$/ -deploys3-branch: - image: "python:latest" +deploy-branch: + image: "node:17" stage: deploy before_script: - - pip install awscli + - npm install -g netlify-cli --unsafe-perm=true script: - - aws s3 cp public s3://${S3_BUCKET_NAME}/${CI_COMMIT_REF_SLUG} --recursive - environment: - name: ${CI_COMMIT_REF_SLUG} - url: http://${S3_BUCKET_NAME}.s3-website-${AWS_BUCKET_REGION}.amazonaws.com/${CI_COMMIT_REF_SLUG} - on_stop: deploys3-clean + - netlify deploy --site $NETLIFY_SITE --auth $NETLIFY_AUTH_TOKEN --dir public except: - /^master$/ deploys3-master: - image: "python:latest" + image: "node:17" stage: deploy before_script: - - pip install awscli + - npm install -g netlify-cli --unsafe-perm=true script: - - aws s3 cp public s3://${S3_BUCKET_NAME}/ --recursive - environment: - name: ${CI_COMMIT_REF_SLUG} - url: http://${S3_BUCKET_NAME}.s3-website-${AWS_BUCKET_REGION}.amazonaws.com/ + - netlify deploy --site $NETLIFY_SITE --auth $NETLIFY_AUTH_TOKEN --dir public --prod only: - /^master$/ - -deploys3-clean: - image: "python:latest" - stage: deploy - before_script: - - pip install awscli - script: - - aws s3 rm s3://${S3_BUCKET_NAME}/${CI_COMMIT_REF_SLUG} --recursive - environment: - name: ${CI_COMMIT_REF_SLUG} - action: stop - when: manual diff --git a/config.toml b/config.toml index 772550a..3e23e73 100644 --- a/config.toml +++ b/config.toml @@ -2,7 +2,7 @@ contentDir = "content" layoutDir = "layouts" publishDir = "public" buildDrafts = false -baseURL = "https://recettes.inf3.ch" +#baseURL = "https://recettes.inf3.ch" canonifyURLs = true theme = "hugo-recettes" diff --git a/themes/hugo-recettes/layouts/index.rss.xml b/themes/hugo-recettes/layouts/index.rss.xml index 0d345fe..5f327ec 100644 --- a/themes/hugo-recettes/layouts/index.rss.xml +++ b/themes/hugo-recettes/layouts/index.rss.xml @@ -11,7 +11,7 @@ {{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }} {{ .Permalink }}index.html Les dernières recettes - Hugo - {{ .Hugo.Version }} - gohugo.io{{ with .Site.LanguageCode }} + Hugo - {{ hugo.Version }} - gohugo.io{{ with .Site.LanguageCode }} {{.}}{{end}}{{ with .Site.Copyright }} {{.}}{{end}} {{ with .Site.LastChange }} diff --git a/themes/hugo-recettes/layouts/partials/navbox.html b/themes/hugo-recettes/layouts/partials/navbox.html index d8816fb..13b6220 100644 --- a/themes/hugo-recettes/layouts/partials/navbox.html +++ b/themes/hugo-recettes/layouts/partials/navbox.html @@ -3,10 +3,7 @@