Skip to content

Merge branch 'main' into feature/clean-up-newlines #207

Merge branch 'main' into feature/clean-up-newlines

Merge branch 'main' into feature/clean-up-newlines #207

Workflow file for this run

name: Build eMoflon website
on:
push:
# Run pipeline for commits on branch 'main' and on 'testing/<stuff>'
branches:
- main
- 'testing/**'
- 'feature/**'
- 'hotfix/**'
env:
# Hugo version to use
VERSION: "0.134.2"
# Hugo release source
HUGO_RELEASE_SRC: "https://github.com/gohugoio/hugo/releases"
jobs:
hugo-build:
runs-on: [ubuntu-20.04]
steps:
- name: Install Hugo
run: |
export HUGO_DEB_FILE=hugo_extended_${VERSION}_linux-amd64.deb
echo "Using URL: $HUGO_RELEASE_SRC/download/v$VERSION/$HUGO_DEB_FILE"
wget -q $HUGO_RELEASE_SRC/download/v$VERSION/$HUGO_DEB_FILE
sudo dpkg -i $HUGO_DEB_FILE
- name: Check out repository code
uses: actions/checkout@v4
with:
submodules: 'recursive'
- name: Build production site
run: |
hugo
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: public-prod
path: public/
- name: Build draft site
run: |
rm -rf public/*
hugo -D
- name: Upload artifact
uses: actions/upload-artifact@v4
with:
name: public-draft
path: public/
check-urls-prod:
needs: [hugo-build]
runs-on: [ubuntu-20.04]
steps:
- name: Check out repository code
uses: actions/checkout@v4
- name: Download Hugo build
uses: actions/download-artifact@v4
with:
name: public-prod
path: public
- name: Docker setup
run: |
docker pull wjdp/htmltest:latest
- name: Run htmltest
run: |
docker run --rm -v $PWD:/test wjdp/htmltest:latest -c /test/.htmltest.yml /test/public
deploy-prod:
needs: [hugo-build, check-urls-prod]
runs-on: [ubuntu-20.04]
# Skip deploy job if branch is 'main'
if: ${{ github.ref == 'refs/heads/main' }}
steps:
- name: Download Hugo build
uses: actions/download-artifact@v4
with:
name: public-prod
- name: Push build artifacts to deployment repository
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY_PROD }}
with:
source-directory: '.'
destination-github-username: 'eMoflon'
destination-repository-name: 'eMoflon.github.io'
user-email: maximilian.kratz@es.tu-darmstadt.de
target-branch: master
deploy-testing:
needs: [hugo-build]
runs-on: [ubuntu-20.04]
# Skip deploy job if branch is 'testing/deploy'
if: ${{ github.ref == 'refs/heads/testing/deploy' }}
steps:
- name: Download Hugo build
uses: actions/download-artifact@v4
with:
name: public-draft
- name: Push build artifacts to deployment repository
uses: cpina/github-action-push-to-another-repository@main
env:
SSH_DEPLOY_KEY: ${{ secrets.SSH_DEPLOY_KEY }}
with:
source-directory: '.'
destination-github-username: 'maxkratz'
destination-repository-name: 'emoflon-website-deploy'
user-email: maximilian.kratz@es.tu-darmstadt.de
target-branch: testing