Skip to content

Build and deploy a PR on dev.iscsc.fr #57

Build and deploy a PR on dev.iscsc.fr

Build and deploy a PR on dev.iscsc.fr #57

Workflow file for this run

name: Build and deploy a PR on dev.iscsc.fr
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Trigger the workflow on every pull request, but because of the environment (later defined)
# it will require manual approval to run
pull_request:
jobs:
# Build job
build-and-deploy-dev:
runs-on: ubuntu-latest
# Force to respect the 'dev-deployment' environment rules, in our case 1 maintainer approval
environment: deployment-dev
steps:
# Checkout repo AND ITS SUBMODULES
- name: πŸ›’ Checkout
uses: actions/checkout@v4
with:
submodules: recursive
- name: πŸ’‰ Inject Development Banner
run: |
cat ./development_banner.html >> ./src/themes/poison/layouts/partials/sidebar/sidebar.html
# Build the static website with the provided docker-compose rules, overriding some elements, see docker-compose.dev.yml
- name: πŸ› οΈ Build with HUGO
run: |
docker compose -f docker-compose.yml -f docker-compose.dev.yml run builder
# Create the SSH key file and fill the known_hosts to avoid a prompt from ssh (1st time connecting to remote host)
- name: πŸ” Create Key File
run: |
mkdir ~/.ssh
touch ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
- name: πŸ” Load Host Keys
run: |
echo "${{ secrets.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
- name: πŸ”‘ Populate Key
run: |
echo "${{ secrets.PRIVATE_SSH_KEY }}" > ~/.ssh/id_rsa
# Upload the build to the remote server location: the volume shared by the nginx container serving http requests
- name: πŸš€ Upload
run: |
rsync --archive --stats --verbose --delete ./build/blog/dev/* ${{ secrets.CI_USER_NAME }}@iscsc.fr:${{ secrets.REPO_PATH_ON_REMOTE }}/build/blog/dev