Merge branch 'contrib/use-netlify' into 'master'
ci: Use Netlify See merge request commun/recettes!20
This commit is contained in:
commit
585f824394
5 changed files with 19 additions and 49 deletions
5
.gitignore
vendored
5
.gitignore
vendored
|
@ -2,3 +2,8 @@
|
||||||
/public/
|
/public/
|
||||||
/resources/
|
/resources/
|
||||||
|
|
||||||
|
# Local Netlify folder
|
||||||
|
.netlify
|
||||||
|
|
||||||
|
.hugo_build.lock
|
||||||
|
hugo
|
||||||
|
|
|
@ -1,64 +1,32 @@
|
||||||
variables:
|
variables:
|
||||||
S3_BUCKET_NAME: recettes.inf3.ch
|
NETLIFY_SITE: recettes-4f3ee
|
||||||
AWS_BUCKET_REGION: us-east-1
|
HUGO_ENV: production
|
||||||
|
|
||||||
gohugo-build-branch:
|
gohugo-build:
|
||||||
image: monachus/hugo:v0.63.1
|
image: klakegg/hugo:0.95.0-debian
|
||||||
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
|
|
||||||
script:
|
script:
|
||||||
- hugo
|
- hugo
|
||||||
artifacts:
|
artifacts:
|
||||||
expire_in: 1 week
|
expire_in: 1 week
|
||||||
paths:
|
paths:
|
||||||
- public
|
- public
|
||||||
only:
|
|
||||||
- /^master$/
|
|
||||||
|
|
||||||
deploys3-branch:
|
deploy-branch:
|
||||||
image: "python:latest"
|
image: "node:17"
|
||||||
stage: deploy
|
stage: deploy
|
||||||
before_script:
|
before_script:
|
||||||
- pip install awscli
|
- npm install -g netlify-cli --unsafe-perm=true
|
||||||
script:
|
script:
|
||||||
- aws s3 cp public s3://${S3_BUCKET_NAME}/${CI_COMMIT_REF_SLUG} --recursive
|
- netlify deploy --site $NETLIFY_SITE --auth $NETLIFY_AUTH_TOKEN --dir public
|
||||||
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
|
|
||||||
except:
|
except:
|
||||||
- /^master$/
|
- /^master$/
|
||||||
|
|
||||||
deploys3-master:
|
deploys3-master:
|
||||||
image: "python:latest"
|
image: "node:17"
|
||||||
stage: deploy
|
stage: deploy
|
||||||
before_script:
|
before_script:
|
||||||
- pip install awscli
|
- npm install -g netlify-cli --unsafe-perm=true
|
||||||
script:
|
script:
|
||||||
- aws s3 cp public s3://${S3_BUCKET_NAME}/ --recursive
|
- netlify deploy --site $NETLIFY_SITE --auth $NETLIFY_AUTH_TOKEN --dir public --prod
|
||||||
environment:
|
|
||||||
name: ${CI_COMMIT_REF_SLUG}
|
|
||||||
url: http://${S3_BUCKET_NAME}.s3-website-${AWS_BUCKET_REGION}.amazonaws.com/
|
|
||||||
only:
|
only:
|
||||||
- /^master$/
|
- /^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
|
|
||||||
|
|
|
@ -2,7 +2,7 @@ contentDir = "content"
|
||||||
layoutDir = "layouts"
|
layoutDir = "layouts"
|
||||||
publishDir = "public"
|
publishDir = "public"
|
||||||
buildDrafts = false
|
buildDrafts = false
|
||||||
baseURL = "https://recettes.inf3.ch"
|
#baseURL = "https://recettes.inf3.ch"
|
||||||
canonifyURLs = true
|
canonifyURLs = true
|
||||||
theme = "hugo-recettes"
|
theme = "hugo-recettes"
|
||||||
|
|
||||||
|
|
|
@ -11,7 +11,7 @@
|
||||||
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
<title>{{ if eq .Title .Site.Title }}{{ .Site.Title }}{{ else }}{{ with .Title }}{{.}} on {{ end }}{{ .Site.Title }}{{ end }}</title>
|
||||||
<link>{{ .Permalink }}index.html</link>
|
<link>{{ .Permalink }}index.html</link>
|
||||||
<description>Les dernières recettes</description>
|
<description>Les dernières recettes</description>
|
||||||
<generator>Hugo - {{ .Hugo.Version }} - gohugo.io</generator>{{ with .Site.LanguageCode }}
|
<generator>Hugo - {{ hugo.Version }} - gohugo.io</generator>{{ with .Site.LanguageCode }}
|
||||||
<language>{{.}}</language>{{end}}{{ with .Site.Copyright }}
|
<language>{{.}}</language>{{end}}{{ with .Site.Copyright }}
|
||||||
<copyright>{{.}}</copyright>{{end}}
|
<copyright>{{.}}</copyright>{{end}}
|
||||||
{{ with .Site.LastChange }}
|
{{ with .Site.LastChange }}
|
||||||
|
|
|
@ -3,10 +3,7 @@
|
||||||
<ul class="list-group list-group-flush">
|
<ul class="list-group list-group-flush">
|
||||||
{{ with .Site.GetPage "/recettes" }}
|
{{ with .Site.GetPage "/recettes" }}
|
||||||
{{ range sort .Sections ".Title" "asc"}}
|
{{ range sort .Sections ".Title" "asc"}}
|
||||||
{{ if eq $parentPage.File.UniqueID .File.UniqueID }}
|
<a class="list-group-item d-flex justify-content-between list-group-item-action align-items-center" href="{{ .Permalink }}index.html">
|
||||||
{{ $active := "active" }}
|
|
||||||
{{ end }}
|
|
||||||
<a class="list-group-item d-flex justify-content-between list-group-item-action align-items-center $active" href="{{ .Permalink }}index.html">
|
|
||||||
{{ .Title }}
|
{{ .Title }}
|
||||||
<span class="badge badge-secondary badge-pill">{{ len .Pages }}</span>
|
<span class="badge badge-secondary badge-pill">{{ len .Pages }}</span>
|
||||||
</a>
|
</a>
|
||||||
|
|
Loading…
Add table
Reference in a new issue