Updates GitHub Actions: checkout, download artifact, upload artifact #175
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.101.0" | |
# 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-64bit.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: [email protected] | |
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: [email protected] | |
target-branch: testing |