Skip to content

use sockets

use sockets #288

Workflow file for this run

# This is a basic workflow to help you get started with Actions
name: Pull request build and deploy
# Controls when the action will run.
on:
# Triggers the workflow on push or pull request events but only for the master branch
pull_request:
branches: [ master ]
# 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 "[zeus.ugent.be]:2222 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBC87/Q3H8f7ghmA+iCtKGaNyk0fx3Z36Xrn+eGv8a4pD7MXeu6Uwr0aN5HnkcbRWXFtMwnAU3ptoP90vH7qu99w=\n[herbert.ugent.be]:2222 ecdsa-sha2-nistp256 AAAAE2VjZHNhLXNoYTItbmlzdHAyNTYAAAAIbmlzdHAyNTYAAABBBGLnJMh2DgqpVnHxOmeV6KffvzZGEVfniq0NFHRGZoL4f7Uc8xeG9gn3cc7lCL02F9LwWZNwR4gSqhGt/RK2S54=\n" >> ~/.ssh/known_hosts
ssh-agent -a $SSH_AUTH_SOCK > /dev/null
ssh-add /home/runner/.ssh/id_ed25519
- name: Deploy site to staging area
env:
PR_NUMBER: ${{ github.event.pull_request.number }}
SSH_AUTH_SOCK: /tmp/ssh_agent.sock
run: |
cd output
rsync -aR --rsh='ssh -p 2222' . "[email protected]:/home/zeuspr/public/$PR_NUMBER/"
- name: Place comment on PR
env:
PR_NR: ${{ github.event.pull_request.number }}
COMMENT_TOKEN: ${{ secrets.COMMENT_TOKEN }}
run: bash ./comment.sh