Files
theread.me/.github/workflows/publish.yml
T

51 lines
1.6 KiB
YAML

name: Build and publish blog
on:
push:
branches: [master]
workflow_dispatch:
permissions:
contents: read
concurrency:
group: blog-production
cancel-in-progress: false
jobs:
publish:
if: github.ref == 'refs/heads/master'
runs-on: ubuntu-22.04
timeout-minutes: 30
steps:
- uses: actions/checkout@d23441a48e516b6c34aea4fa41551a30e30af803 # v6
with:
persist-credentials: false
- name: Test deployment scripts
run: python3 -m unittest discover -s scripts/tests -v
- name: Test publishing service
run: |
python3 -m pip install -r photo-upload/requirements.txt 'pytest>=8,<10'
python3 -m pytest -q photo-upload/tests
- uses: ruby/setup-ruby@a0102e0972be65f351c307e2d64b9314a57c8073 # v1
with:
ruby-version: '3.1.2'
bundler-cache: true
- name: Test gallery items
run: bundle exec ruby scripts/tests/gallery_items_test.rb
- name: Build Jekyll
env:
JEKYLL_ENV: production
run: bundle exec jekyll build --trace
- name: Record deployed photos
run: python3 scripts/photo-manifest.py
- name: Deploy to nginx server
env:
DEPLOY_HOST: ${{ vars.DEPLOY_HOST || 'theread.me' }}
DEPLOY_USER: ${{ vars.DEPLOY_USER || 'mahdi' }}
DEPLOY_PORT: ${{ vars.DEPLOY_PORT || '22' }}
DEPLOY_PATH: ${{ vars.DEPLOY_PATH || '/home/mahdi/blog-published' }}
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_KNOWN_HOSTS: ${{ secrets.DEPLOY_KNOWN_HOSTS }}
run: bash scripts/deploy-site.sh