Merge branch 'deploy-to-s3' into 'master'
Deploy blog to Amazon S3 See merge request tschwery/blog-hugo!6
This commit is contained in:
commit
1f5feb653d
2 changed files with 52 additions and 8 deletions
|
@ -1,5 +1,9 @@
|
|||
image: golang:1.9
|
||||
|
||||
variables:
|
||||
S3_BUCKET_NAME: thomas.inf3.ch
|
||||
AWS_BUCKET_REGION: us-east-1
|
||||
|
||||
gohugo-build:
|
||||
script:
|
||||
- git submodule sync --recursive
|
||||
|
@ -11,13 +15,41 @@ gohugo-build:
|
|||
paths:
|
||||
- public
|
||||
|
||||
gohugo-deploy:
|
||||
image: kyleondy/alpine-rsync
|
||||
deploys3-branch:
|
||||
image: "python:latest"
|
||||
stage: deploy
|
||||
tags:
|
||||
- pages
|
||||
only:
|
||||
- master
|
||||
before_script:
|
||||
- pip install awscli
|
||||
script:
|
||||
- mkdir -p /volumes/output/thomas
|
||||
- rsync -r public/ /volumes/output/thomas
|
||||
- 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
|
||||
except:
|
||||
- /^master$/
|
||||
|
||||
deploys3-master:
|
||||
image: "python:latest"
|
||||
stage: deploy
|
||||
before_script:
|
||||
- pip install awscli
|
||||
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/
|
||||
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
|
||||
|
|
12
layouts/index.html
Normal file
12
layouts/index.html
Normal file
|
@ -0,0 +1,12 @@
|
|||
{{ partial "header.html" . }}
|
||||
|
||||
<main role="main">
|
||||
{{ range (where .Data.Pages ".Params.hidefromhome" "!=" "true") }}
|
||||
<article itemscope itemtype="http://schema.org/Blog">
|
||||
<h2 class="entry-title" itemprop="headline"><a href="{{ .RelPermalink }}index.html">{{ .Title }}</a></h2>
|
||||
<span class="entry-meta"><time itemprop="datePublished" datetime="{{ .Date.Format "2006-01-02" }}">{{ .Date.Format "January 02, 2006" }}</time></span>
|
||||
</article>
|
||||
{{ end }}
|
||||
</main>
|
||||
|
||||
{{ partial "footer.html" . }}
|
Loading…
Add table
Reference in a new issue