Add authenticated photo uploads and GitHub Actions publishing
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
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
|
||||
- uses: ruby/setup-ruby@a0102e0972be65f351c307e2d64b9314a57c8073 # v1
|
||||
with:
|
||||
ruby-version: '3.1.2'
|
||||
bundler-cache: true
|
||||
- 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
|
||||
Reference in New Issue
Block a user