Skip to content

Build and deploy on master #1245

Build and deploy on master

Build and deploy on master #1245

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Build and deploy on master
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
schedule:
- cron: "00 06 * * *"
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout repository
uses: actions/checkout@v2
- name: Checkout submodule
run: git submodule update --init --recursive --remote
- name: Cache install Nix packages
uses: rikhuijzer/cache-install@249745afd54c8e2be0eb99aa6032b52629239b48
with:
key: nix-${{ hashFiles('packages.nix') }}
nix_file: 'packages.nix'
- name: Cache Output
id: cache-output
uses: actions/cache@v3
with:
path: |
./tmp/
./output/
key: build-${{ github.ref_name }}
restore-keys: |
build-master
- name: Set environment variable
run: "export LANG=en_US.UTF-8"
- name: Build site
run: "nanoc --env=prod"
- name: Run checks
run: "nanoc --env=prod check --deploy"
- name: Add private key
shell: bash
env:
PRIVATE_KEY: ${{ secrets.DEPLOYMENT_PRIVATE_KEY }}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
mkdir -p /home/runner/.ssh
echo "$PRIVATE_KEY" > /home/runner/.ssh/id_ed25519
chmod 600 /home/runner/.ssh/id_ed25519
echo -e "[pratchett.ugent.be]:2222 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBIs8YMbO+aiTRlbi7++8CAqzq46zNLMsYAH3ycub6zkCFPKwIsePDlHJhMgTWG54Vwon60UT6FYyrBYbVfAWY1I=\n[pratchett.zeus.gent]:2222 ssh-ed25519 AAAAC3NzaC1lZDI1NTE5AAAAIIs8IQpKz24LZuZZ43yEMqelfKmk+3C62+FA15HHZEK6\n" >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add /home/runner/.ssh/id_ed25519
- name: Deploy to production
env:
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: "nanoc --env=prod deploy public"