Skip to content

Build, test and deploy website (if needed) #854

Build, test and deploy website (if needed)

Build, test and deploy website (if needed) #854

name: build_test_deploy
run-name: Build, test and deploy website (if needed)
on:
push:
branches:
- main
pull_request:
branches:
- main
schedule:
- cron: "15 3 * * *"
jobs:
build_and_test:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Install ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.1'
bundler-cache: true
- name: Install python
uses: actions/setup-python@v4
with:
python-version: '3.7'
- name: install prerequisites
run: pip3 install html5validator requests && gem install --no-document html-proofer
- name: Update external content
run: ./update.sh
- name: Clean up stubs
run: rm -rf _cases/3000 _cves/CVE-3000-* csirt.divd.nl/_cases/3000 csirt.divd.nl/_cves/CVE-3000-*
- name: Build
run: bundle exec jekyll build --future 2>&1 | tee jekyll-build.log
- name: "Fix security.txt"
run: mkdir _site/.well-known && (cd _site/.well-known && ln -s ../security.txt) && ls -al _site/.well-known
- name: Test HTML code
run: ./proof_html.sh
- name: rsync deploy
uses: burnett01/[email protected]
if: ${{ github.ref == 'refs/heads/main' }}
with:
switches: -avzr --delete
path: _site/
remote_path: htdocs/divd-nl
remote_host: ${{ secrets.DEPLOY_HOST }}
remote_user: ${{ secrets.DEPLOY_USER }}
remote_key: ${{ secrets.DEPLOY_KEY_WWW }}
- name: Deploy Admin inteface to GitHub pages
uses: JamesIves/github-pages-deploy-action@v4
if: ${{ github.ref == 'refs/heads/main' }}
with:
folder: admin # The folder the action should deploy.
- name: Slack notify failure (website)
if: failure()
uses: voxmedia/github-action-slack-notify-build@v1
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel: website
status: FAILED
color: danger
- name: Slack notify failure (communcations)
if: failure()
uses: voxmedia/github-action-slack-notify-build@v1
env:
SLACK_BOT_TOKEN: ${{ secrets.SLACK_BOT_TOKEN }}
with:
channel: communications
status: FAILED
color: danger