Compare commits

..

No commits in common. "04bb3d712b9c79a38d544992156c769db8763e2d" and "b4640f3fe302cd229ec9fecd98ddecf3ca4beb05" have entirely different histories.

3 changed files with 17 additions and 20 deletions

View file

@ -8,9 +8,8 @@ on:
env:
_UID: 1000
_GID: 1000
WEB_DOMAIN: tahoe-lafs.org
WEB_HOST: webforge.of.tahoe-lafs.org
WEB_USER: bot-www
WEB_DOMAIN: lafs.eval.latfa.net
WEB_USER: www
WEB_DIR: /var/www
jobs:
jekyll:
@ -19,7 +18,6 @@ jobs:
- name: Check out repository
id: checkout
uses: actions/checkout@v4
github-server-url: 'https://forge.of.tahoe-lafs.org/'
- name: Change file ownership
id: file_ownership
run: |
@ -46,7 +44,7 @@ jobs:
- name: Build Jekyll site
id: build_site
run: |
# Overwrite the baseurl for preview only
# 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
@ -58,17 +56,16 @@ jobs:
id: deploy_site
run: |
if [ "${{ gitea.ref }}" = 'refs/heads/main' ]; then
WEB_ROOT="${WEB_DIR}/live"
WEB_VHOST="home.of.${WEB_DOMAIN}"
WEB_ROOT="${WEB_DIR}/site"
WEB_HOST="www.${WEB_DOMAIN}"
WEB_CONTEXT='/'
else
WEB_ROOT="${WEB_DIR}/preview"
WEB_VHOST="preview.of.${WEB_DOMAIN}"
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_VHOST=${WEB_VHOST}" >> $GITHUB_ENV
echo "WEB_CONTEXT=${WEB_CONTEXT}" >> $GITHUB_ENV
# Prepare ssh key
echo "${{ secrets.WWW_DEPLOY_KEY }}" > ~/.ssh/id_ed25519
@ -76,23 +73,23 @@ jobs:
# Synchronize the local and the remote site
rsync -halvi --delete \
-e "ssh -a -x -o StrictHostKeyChecking=no" \
./_site/ "${WEB_USER}@${WEB_HOST}:${WEB_ROOT}${WEB_CONTEXT}"
./_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: https://github.com/exercism/pr-commenter-action@v1.5.1
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_VHOST }}",
"deployWebHost": "${{ env.WEB_HOST }}",
"deployWebContext": "${{ env.WEB_CONTEXT }}",
"gitActor": "${{ forgejo.actor }}",
"gitEventName": "${{ forgejo.event_name }}",
"gitWorkflow": "${{ forgejo.workflow }}",
"gitRunNumber": "${{ forgejo.run_number }}",
"gitRunAttempt": "${{ forgejo.run_attempt }}"
"gitActor": "${{ gitea.actor }}",
"gitEventName": "${{ gitea.event_name }}",
"gitWorkflow": "${{ gitea.workflow }}",
"gitRunNumber": "${{ gitea.run_number }}",
"gitRunAttempt": "${{ gitea.run_attempt }}"
}
config-file: ".gitea/pr-commenter.yml"

View file

@ -6,10 +6,10 @@ on:
types: [ closed ]
env:
WEB_HOST: webforge.of.tahoe-lafs.org
WEB_DOMAIN: lafs.eval.latfa.net
WEB_USER: www
WEB_ROOT: /var/www/preview
WEB_CONTEXT: "/${{ forgejo.event.pull_request.number }}/"
WEB_CONTEXT: "/${{ gitea.event.pull_request.number }}/"
jobs:
jekyll_cleanup:
runs-on: ubuntu-22.04
@ -32,4 +32,4 @@ jobs:
chmod 600 ~/.ssh/id_ed25519
# Delete preview context from the remote site
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_HOST}
| lftp sftp://${WEB_USER}:unused@${WEB_DOMAIN}