Signed-off-by: Benoit Donneaux <benoit@leastauthority.com> Reviewed-on: #5 Co-authored-by: Benoit Donneaux <benoit@leastauthority.com> Co-committed-by: Benoit Donneaux <benoit@leastauthority.com>
This commit is contained in:
parent
2dbbc5c2aa
commit
5eb87a6bf5
|
@ -0,0 +1,28 @@
|
||||||
|
comment:
|
||||||
|
glob-options:
|
||||||
|
dot: true
|
||||||
|
snippets:
|
||||||
|
- id: image-{{ imageOutcome }}
|
||||||
|
files:
|
||||||
|
- '**'
|
||||||
|
body: |
|
||||||
|
#### :hammer: Docker build `{{ imageOutcome }}`
|
||||||
|
|
||||||
|
- id: build-{{ buildOutcome }}
|
||||||
|
files:
|
||||||
|
- '**'
|
||||||
|
body: |
|
||||||
|
#### :wrench: Jekyll build `{{ buildOutcome }}`
|
||||||
|
|
||||||
|
- id: deploy-{{ deployOutcome }}
|
||||||
|
files:
|
||||||
|
- '**'
|
||||||
|
body: |
|
||||||
|
#### :rocket: Jekyll deploy `{{ deployOutcome }}`
|
||||||
|
#### :link: Preview site [here](https://{{ deployWebHost }}{{ deployWebContext }})
|
||||||
|
|
||||||
|
- id: pusher-{{ gitActor }}-{{ gitEventName }}-{{ gitRunNumber }}
|
||||||
|
files:
|
||||||
|
- '**'
|
||||||
|
body: |
|
||||||
|
*Pusher: @{{ gitActor }}, Action: `{{ gitEventName }}`, Workflow: `{{ gitWorkflow }}`, Run: {{ gitRunNumber }}*
|
|
@ -8,6 +8,9 @@ on:
|
||||||
env:
|
env:
|
||||||
_UID: 1000
|
_UID: 1000
|
||||||
_GID: 1000
|
_GID: 1000
|
||||||
|
WEB_DOMAIN: lafs.eval.latfa.net
|
||||||
|
WEB_USER: www
|
||||||
|
WEB_DIR: /var/www
|
||||||
jobs:
|
jobs:
|
||||||
jekyll:
|
jekyll:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
@ -41,18 +44,52 @@ jobs:
|
||||||
- name: Build Jekyll site
|
- name: Build Jekyll site
|
||||||
id: build_site
|
id: build_site
|
||||||
run: |
|
run: |
|
||||||
|
# Overwrite the baseurl for previewonly
|
||||||
|
if [ "${{ gitea.event_name }}" = 'pull_request' ]; then
|
||||||
|
echo "Overwriting baseurl for pull_request ${{ gitea.event.pull_request.number }}"
|
||||||
|
sed -i -r -e 's/^baseurl:\s*"([^"]*)"/baseurl: "\1\/${{ gitea.event.pull_request.number }}"/' _config.yml
|
||||||
|
grep "^baseurl:" _config.yml
|
||||||
|
fi
|
||||||
docker-compose run --rm -v "${JOB_CONTAINER_NAME}:/site" -w /site \
|
docker-compose run --rm -v "${JOB_CONTAINER_NAME}:/site" -w /site \
|
||||||
jekyll build --verbose
|
jekyll build --verbose
|
||||||
- name: Prepare ssh key
|
- name: Deploy Jekyll site
|
||||||
id: prepare_ssh_key
|
id: deploy_site
|
||||||
if: ${{ gitea.ref == 'refs/heads/main' }}
|
|
||||||
run: |
|
run: |
|
||||||
|
if [ "${{ gitea.ref }}" = 'refs/heads/main' ]; then
|
||||||
|
WEB_ROOT="${WEB_DIR}/site"
|
||||||
|
WEB_HOST="www.${WEB_DOMAIN}"
|
||||||
|
WEB_CONTEXT='/'
|
||||||
|
else
|
||||||
|
WEB_ROOT="${WEB_DIR}/preview"
|
||||||
|
WEB_HOST="preview.${WEB_DOMAIN}"
|
||||||
|
WEB_CONTEXT='/${{ gitea.event.pull_request.number }}/'
|
||||||
|
fi
|
||||||
|
# Save those variabes in the environment for the next steps
|
||||||
|
echo "WEB_HOST=${WEB_HOST}" >> $GITHUB_ENV
|
||||||
|
echo "WEB_CONTEXT=${WEB_CONTEXT}" >> $GITHUB_ENV
|
||||||
|
# Prepare ssh key
|
||||||
echo "${{ secrets.WWW_DEPLOY_KEY }}" > ~/.ssh/id_ed25519
|
echo "${{ secrets.WWW_DEPLOY_KEY }}" > ~/.ssh/id_ed25519
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
- name: Publish Jekyll site
|
# Synchronize the local and the remote site
|
||||||
id: publish_site
|
rsync -halvi --delete \
|
||||||
if: ${{ gitea.ref == 'refs/heads/main' }}
|
|
||||||
run: |
|
|
||||||
rsync -halvi \
|
|
||||||
-e "ssh -a -x -o StrictHostKeyChecking=no" \
|
-e "ssh -a -x -o StrictHostKeyChecking=no" \
|
||||||
./_site/ www@lafs.eval.latfa.net:/var/www/site/
|
./_site/ "${WEB_USER}@${WEB_DOMAIN}:${WEB_ROOT}${WEB_CONTEXT}"
|
||||||
|
- name: Comment pull request
|
||||||
|
id: comment_pull_request
|
||||||
|
if: ${{ always() && gitea.event_name == 'pull_request' }}
|
||||||
|
uses: exercism/pr-commenter-action@v1.5.1
|
||||||
|
with:
|
||||||
|
template-variables: |
|
||||||
|
{
|
||||||
|
"imageOutcome": "${{ steps.build_image.outcome }}",
|
||||||
|
"buildOutcome": "${{ steps.build_site.outcome }}",
|
||||||
|
"deployOutcome": "${{ steps.deploy_site.outcome }}",
|
||||||
|
"deployWebHost": "${{ env.WEB_HOST }}",
|
||||||
|
"deployWebContext": "${{ env.WEB_CONTEXT }}",
|
||||||
|
"gitActor": "${{ gitea.actor }}",
|
||||||
|
"gitEventName": "${{ gitea.event_name }}",
|
||||||
|
"gitWorkflow": "${{ gitea.workflow }}",
|
||||||
|
"gitRunNumber": "${{ gitea.run_number }}",
|
||||||
|
"gitRunAttempt": "${{ gitea.run_attempt }}"
|
||||||
|
}
|
||||||
|
config-file: ".gitea/pr-commenter.yml"
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
name: Jekyll cleanup
|
||||||
|
|
||||||
|
# only trigger on pull request closed events
|
||||||
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [ closed ]
|
||||||
|
|
||||||
|
env:
|
||||||
|
WEB_DOMAIN: lafs.eval.latfa.net
|
||||||
|
WEB_USER: www
|
||||||
|
WEB_ROOT: /var/www/preview
|
||||||
|
WEB_CONTEXT: "/${{ gitea.event.pull_request.number }}/"
|
||||||
|
jobs:
|
||||||
|
jekyll_cleanup:
|
||||||
|
runs-on: ubuntu-22.04
|
||||||
|
permissions:
|
||||||
|
pull-requests: write
|
||||||
|
actions: read
|
||||||
|
contents: read
|
||||||
|
steps:
|
||||||
|
- name: Cleanup Jeyll preview
|
||||||
|
id: cleanup_preview
|
||||||
|
run: |
|
||||||
|
# Prepare ssh key
|
||||||
|
echo "${{ secrets.WWW_DEPLOY_KEY }}" > ~/.ssh/id_ed25519
|
||||||
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
|
# Delete preview context from the remote site
|
||||||
|
sudo apt install -y lftp
|
||||||
|
echo -e "set sftp:connect-program ssh -a -x -o StrictHostKeyChecking=no; rm -r -f ${WEB_ROOT}${WEB_CONTEXT}\nbye" \
|
||||||
|
| lftp sftp://${WEB_USER}:unused@${WEB_DOMAN}
|
|
@ -1,5 +1,5 @@
|
||||||
<!-- start custom head snippets -->
|
<!-- start custom head snippets -->
|
||||||
|
|
||||||
<link href="/assets/images/favicon.ico" rel="shortcut icon" type="image/x-icon">
|
<link href="assets/images/favicon.ico" rel="shortcut icon" type="image/x-icon">
|
||||||
|
|
||||||
<!-- end custom head snippets -->
|
<!-- end custom head snippets -->
|
||||||
|
|
|
@ -6,7 +6,7 @@ excerpt: "Welcome to Dummy Jekyll"
|
||||||
header:
|
header:
|
||||||
teaser: /assets/images/posts/unsplash-welcome.jpg
|
teaser: /assets/images/posts/unsplash-welcome.jpg
|
||||||
gallery:
|
gallery:
|
||||||
- image_path: assets/images/posts/unsplash-welcome.jpg
|
- image_path: /assets/images/posts/unsplash-welcome.jpg
|
||||||
alt: "welcome"
|
alt: "welcome"
|
||||||
---
|
---
|
||||||
{% include gallery %}
|
{% include gallery %}
|
||||||
|
|
|
@ -6,7 +6,7 @@ excerpt: "This is a generic post."
|
||||||
header:
|
header:
|
||||||
teaser: /assets/images/posts/unsplash-post.jpg
|
teaser: /assets/images/posts/unsplash-post.jpg
|
||||||
gallery:
|
gallery:
|
||||||
- image_path: assets/images/posts/unsplash-post.jpg
|
- image_path: /assets/images/posts/unsplash-post.jpg
|
||||||
alt: "post"
|
alt: "post"
|
||||||
---
|
---
|
||||||
{% include gallery %}
|
{% include gallery %}
|
||||||
|
|
|
@ -6,7 +6,7 @@ excerpt: "This is a generic post."
|
||||||
header:
|
header:
|
||||||
teaser: /assets/images/posts/unsplash-post.jpg
|
teaser: /assets/images/posts/unsplash-post.jpg
|
||||||
gallery:
|
gallery:
|
||||||
- image_path: assets/images/posts/unsplash-post.jpg
|
- image_path: /assets/images/posts/unsplash-post.jpg
|
||||||
alt: "post"
|
alt: "post"
|
||||||
---
|
---
|
||||||
{% include gallery %}
|
{% include gallery %}
|
||||||
|
|
|
@ -6,7 +6,7 @@ excerpt: "This is a generic post."
|
||||||
header:
|
header:
|
||||||
teaser: /assets/images/posts/unsplash-post.jpg
|
teaser: /assets/images/posts/unsplash-post.jpg
|
||||||
gallery:
|
gallery:
|
||||||
- image_path: assets/images/posts/unsplash-post.jpg
|
- image_path: /assets/images/posts/unsplash-post.jpg
|
||||||
alt: "post"
|
alt: "post"
|
||||||
---
|
---
|
||||||
{% include gallery %}
|
{% include gallery %}
|
||||||
|
|
|
@ -12,24 +12,24 @@
|
||||||
}*/
|
}*/
|
||||||
/*
|
/*
|
||||||
.page__hero--overlay {
|
.page__hero--overlay {
|
||||||
background: url(/assets/images/pattern-4.gif) repeat left top;
|
background: url(../images/pattern-4.gif) repeat left top;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
.initial-content {
|
.initial-content {
|
||||||
//position: relative;
|
//position: relative;
|
||||||
//top: 70px;
|
//top: 70px;
|
||||||
background: url(/assets/images/pattern-1.png) repeat left top;
|
background: url(../images/pattern-1.png) repeat left top;
|
||||||
}
|
}
|
||||||
/*
|
/*
|
||||||
#about {
|
#about {
|
||||||
background: url(/assets/images/pattern-2.gif) repeat left top;
|
background: url(../images/pattern-2.gif) repeat left top;
|
||||||
}
|
}
|
||||||
|
|
||||||
@font-face {
|
@font-face {
|
||||||
font-family: "homestead_regularregular";
|
font-family: "homestead_regularregular";
|
||||||
font-style: normal;
|
font-style: normal;
|
||||||
font-weight: normal;
|
font-weight: normal;
|
||||||
src: url("/assets/fonts/homestead-regular-webfont.woff") format("woff");
|
src: url("../fonts/homestead-regular-webfont.woff") format("woff");
|
||||||
}
|
}
|
||||||
|
|
||||||
h1, h2, h3, h4, h5, h6, .archive__item-title, .masthead__inner-wrap {
|
h1, h2, h3, h4, h5, h6, .archive__item-title, .masthead__inner-wrap {
|
||||||
|
@ -44,4 +44,4 @@ h1, h2, h3, h4, h5, h6, .archive__item-title, .masthead__inner-wrap {
|
||||||
.archive__item-excerpt {
|
.archive__item-excerpt {
|
||||||
color: #a9862b;
|
color: #a9862b;
|
||||||
}
|
}
|
||||||
*/
|
*/
|
||||||
|
|
|
@ -24,7 +24,7 @@ documentation_list:
|
||||||
url: "https://tahoe-lafs.readthedocs.io/en/latest/about-tahoe.html"
|
url: "https://tahoe-lafs.readthedocs.io/en/latest/about-tahoe.html"
|
||||||
btn_label: "Read More"
|
btn_label: "Read More"
|
||||||
btn_class: "btn--primary"
|
btn_class: "btn--primary"
|
||||||
- image_path: assets/images/manual.jpg
|
- image_path: /assets/images/manual.jpg
|
||||||
image_caption: "Image courtesy of [Unsplash](https://unsplash.com/)"
|
image_caption: "Image courtesy of [Unsplash](https://unsplash.com/)"
|
||||||
alt: "manual"
|
alt: "manual"
|
||||||
title: "Manual"
|
title: "Manual"
|
||||||
|
@ -44,7 +44,7 @@ contribute:
|
||||||
- title: "Get Involved"
|
- title: "Get Involved"
|
||||||
excerpt: ""
|
excerpt: ""
|
||||||
contribute_list:
|
contribute_list:
|
||||||
- image_path: assets/images/mailing.jpg
|
- image_path: /assets/images/mailing.jpg
|
||||||
image_caption: "Image courtesy of [Unsplash](https://unsplash.com/)"
|
image_caption: "Image courtesy of [Unsplash](https://unsplash.com/)"
|
||||||
alt: "mailing"
|
alt: "mailing"
|
||||||
title: "Mailing list"
|
title: "Mailing list"
|
||||||
|
@ -96,10 +96,10 @@ about:
|
||||||
<div class="grid__item">
|
<div class="grid__item">
|
||||||
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
<article class="archive__item" itemscope itemtype="https://schema.org/CreativeWork">
|
||||||
<div class="archive__item-teaser">
|
<div class="archive__item-teaser">
|
||||||
<img src="{{post.header.teaser}}" alt="">
|
<img src="{{ post.header.teaser | relative_url }}" alt="">
|
||||||
</div>
|
</div>
|
||||||
<h2 class="archive__item-title" itemprop="headline">
|
<h2 class="archive__item-title" itemprop="headline">
|
||||||
<a href="{{ post.url }}" rel="permalink">{{ post.title }}</a>
|
<a href="{{ post.url | relative_url }}" rel="permalink">{{ post.title }}</a>
|
||||||
</h2>
|
</h2>
|
||||||
<p class="archive__item-excerpt" itemprop="description">{{ post.excerpt }}</p>
|
<p class="archive__item-excerpt" itemprop="description">{{ post.excerpt }}</p>
|
||||||
</article>
|
</article>
|
||||||
|
|
Loading…
Reference in New Issue