Add YouTube video #14
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 and Deploy Antora Site | |
on: | |
push: | |
branches: | |
- main # adjust this if your primary branch is named differently | |
jobs: | |
build_and_deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install rsync | |
run: sudo apt-get install -y rsync | |
- name: Setup Node.js | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '14' # Antora is known to work well with this version, but you can adjust as needed | |
- name: Install Antora | |
run: | | |
npm install -g antora | |
- name: Build the Antora site | |
run: | | |
antora --fetch antora-playbook.yml # Replace 'antora-playbook.yml' with your playbook's name if different | |
- name: Replace internal index.html links to directories with trailing slash | |
run: | | |
find ./build/site -name "*.html" -exec sed -i 's@href="\([^"]*\)/index.html"@href="\1/"@g' {} \; | |
- name: Deploy to Linux server via SCP | |
env: | |
DEPLOY_KEY: ${{ secrets.DEPLOY_SSH_KEY }} | |
SERVER: ${{ secrets.SERVER_ADDRESS }} | |
USERNAME: ${{ secrets.SERVER_USERNAME }} | |
TARGET: ${{ secrets.SERVER_TARGET_DIRECTORY }} | |
KNOWN_HOSTS: ${{ secrets.KNOWN_HOSTS_ENTRY }} | |
run: | | |
echo "$DEPLOY_KEY" > deploy_key | |
chmod 600 deploy_key | |
echo "$KNOWN_HOSTS" > known_hosts | |
rsync -avz -e 'ssh -i deploy_key -o UserKnownHostsFile=known_hosts' --delete ./build/site/ $USERNAME@$SERVER:$TARGET | |
rm -f deploy_key known_hosts |