Skip to content
This repository has been archived by the owner on Jan 31, 2025. It is now read-only.

One more time

One more time #26

name: Sync the website
on:
push:
branches: [main]
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0 # we need this because Hugo is configured with enableGitInfo = true
- uses: actions/setup-node@v2
with:
node-version: "20"
cache: "npm"
- name: Install dependencies
run: npm install
- name: Setup Hugo
uses: peaceiris/actions-hugo@v2
with:
hugo-version: "0.122.0"
extended: true
- name: Build Hugo site
run: hugo --minify
- name: Build API page
uses: seeebiii/redoc-cli-github-action@v10
with:
args: "bundle --options.disableGoogleFont=true content/api/openapi.yaml -o public/api/index.html"
- name: Create a deploy branch of just the public folder
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./public
publish_branch: deploy
- name: Checkout that deploy branch
run: git checkout -f deploy
# - name: Rsync to the server machine
# uses: burnett01/[email protected]
# with:
# switches: -avzr --delete --exclude=".git" --exclude=".github"
# path: public/
# remote_path: /home/docs/Websites/trueblocks.io
# remote_host: ${{ secrets.HOST }}
# remote_user: ${{ secrets.HOST_USER }}
# remote_key: ${{ secrets.DEPLOY_SSH_KEY }}
# - name: Install linkinator
# run: npm install -g linkinator
# - name: Run lininator
# run: linkinator -r index.html docs/ papers/ data-model/ api/ --skip localhost:23456 --skip tokenomics.io --skip etherscan.io --skip https://twitter.com/trueblocks --skip intro
- name: Deploy to new server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.NEW_SERVER_HOST }}
username: ${{ secrets.DOCS_USER }}
key: ${{ secrets.DOCS_PRIVATE_KEY }}
script: |
cd /home/${{ secrets.DOCS_USER }}/trueblocks.io
git checkout main
git pull
npm run build
chown -R ${{ secrets.DOCS_USER }}:trueblocks .
cp -pR * /var/www/trueblocks.io/html/
echo "Running lininator..."
cd /var/www/trueblocks.io/html/
linkinator -r index.html docs/ papers/ data-model/ api/ --skip localhost:23456 --skip tokenomics.io --skip etherscan.io --skip https://twitter.com/trueblocks --skip intro
- name: Check for failure and report to Discord
uses: rjstone/discord-webhook-notify@v1
if: failure()
with:
severity: error
details: Test Failed!
webhookUrl: ${{ secrets.DISCORD_WEBHOOK }}
- name: Report job status
run: |
echo "This job's status is ${{ job.status }}"