Deploy preview in dedicated root with context per PR
Jekyll / jekyll (pull_request) Failing after 21s
Details
Jekyll / jekyll (pull_request) Failing after 21s
Details
Signed-off-by: Benoit Donneaux <benoit@leastauthority.com>
This commit is contained in:
parent
4d7cfaf6c3
commit
a0d865d21b
|
@ -6,13 +6,13 @@ comment:
|
||||||
files:
|
files:
|
||||||
- '**'
|
- '**'
|
||||||
body: |
|
body: |
|
||||||
#### :hammer: Docker image `{{ imageOutcome }}`
|
#### :hammer: Docker build `{{ imageOutcome }}`
|
||||||
|
|
||||||
- id: build-{{ buildOutcome }}
|
- id: build-{{ buildOutcome }}
|
||||||
files:
|
files:
|
||||||
- '**'
|
- '**'
|
||||||
body: |
|
body: |
|
||||||
#### :mag: Jekyll build `{{ buildOutcome }}`
|
#### :wrench: Jekyll build `{{ buildOutcome }}`
|
||||||
<details><summary>Build Output</summary>
|
<details><summary>Build Output</summary>
|
||||||
|
|
||||||
```
|
```
|
||||||
|
@ -26,7 +26,7 @@ comment:
|
||||||
- '**'
|
- '**'
|
||||||
body: |
|
body: |
|
||||||
#### :rocket: Jekyll deploy `{{ deployOutcome }}`
|
#### :rocket: Jekyll deploy `{{ deployOutcome }}`
|
||||||
#### :link: Preview documentation [here](https://www.lafs.eval.latfa.net/{{ deployPrefix}}/{{ deploySuffix }})
|
#### :link: Preview site [here](https://{{ deployWebHost }}{{ deployWebContext }})
|
||||||
|
|
||||||
- id: pusher-{{ gitActor }}-{{ gitEventName }}-{{ gitRunNumber }}
|
- id: pusher-{{ gitActor }}-{{ gitEventName }}-{{ gitRunNumber }}
|
||||||
files:
|
files:
|
||||||
|
|
|
@ -8,8 +8,9 @@ on:
|
||||||
env:
|
env:
|
||||||
_UID: 1000
|
_UID: 1000
|
||||||
_GID: 1000
|
_GID: 1000
|
||||||
PREFIX: site
|
WEB_DOMAIN: lafs.eval.latfa.net
|
||||||
SUFFIX: preview
|
WEB_USER: www
|
||||||
|
WEB_DIR: /var/www
|
||||||
jobs:
|
jobs:
|
||||||
jekyll:
|
jekyll:
|
||||||
runs-on: ubuntu-22.04
|
runs-on: ubuntu-22.04
|
||||||
|
@ -54,11 +55,23 @@ jobs:
|
||||||
chmod 600 ~/.ssh/id_ed25519
|
chmod 600 ~/.ssh/id_ed25519
|
||||||
- name: Deploy Jekyll site
|
- name: Deploy Jekyll site
|
||||||
id: deploy_site
|
id: deploy_site
|
||||||
if: ${{ gitea.ref == 'refs/heads/main' }}
|
|
||||||
run: |
|
run: |
|
||||||
rsync -halvi \
|
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 }}/'
|
||||||
|
end
|
||||||
|
# Save those variabes in the environment for the next steps
|
||||||
|
echo "WEB_HOST=${WEB_HOST}" >> $GITEA_ENV
|
||||||
|
echo "WEB_CONTEXT=${WEB_CONTEXT}" >> $GITEA_ENV
|
||||||
|
# Synchronize the local and the remote site
|
||||||
|
rsync -halvi --delete \
|
||||||
-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
|
- name: Comment pull request
|
||||||
id: comment_pull_request
|
id: comment_pull_request
|
||||||
if: gitea.event_name == 'pull_request'
|
if: gitea.event_name == 'pull_request'
|
||||||
|
@ -70,8 +83,8 @@ jobs:
|
||||||
"buildOutcome": "${{ steps.build_site.outcome }}",
|
"buildOutcome": "${{ steps.build_site.outcome }}",
|
||||||
"buildOutputsResult": ${{ toJSON(steps.build_site.outputs.result) }},
|
"buildOutputsResult": ${{ toJSON(steps.build_site.outputs.result) }},
|
||||||
"deployOutcome": "${{ steps.deploy_site.outcome }}",
|
"deployOutcome": "${{ steps.deploy_site.outcome }}",
|
||||||
"deployPrefix": "${{ env.PREFIX }}",
|
"deployWebHost": "${{ env.WEB_HOST }}",
|
||||||
"deploySuffix": "${{ env.SUFFIX }}",
|
"deployWebContext": "${{ env.WEB_CONTEXT }}",
|
||||||
"gitActor": "${{ gitea.actor }}",
|
"gitActor": "${{ gitea.actor }}",
|
||||||
"gitEventName": "${{ gitea.event_name }}",
|
"gitEventName": "${{ gitea.event_name }}",
|
||||||
"gitWorkflow": "${{ gitea.workflow }}",
|
"gitWorkflow": "${{ gitea.workflow }}",
|
||||||
|
@ -83,5 +96,5 @@ jobs:
|
||||||
id: fail-on-error
|
id: fail-on-error
|
||||||
if: |
|
if: |
|
||||||
steps.build_site.outcome != 'success'
|
steps.build_site.outcome != 'success'
|
||||||
|| (github.event_name == 'pull_request' && steps.deploy_site.outcome != 'success')
|
|| (gittea.event_name == 'pull_request' && steps.deploy_site.outcome != 'success')
|
||||||
run: exit 1
|
run: exit 1
|
||||||
|
|
Loading…
Reference in New Issue