83 lines
2.3 KiB
YAML
83 lines
2.3 KiB
YAML
name: Deploy
|
|
on: [push, workflow_dispatch]
|
|
jobs:
|
|
deploy:
|
|
runs-on: ubuntu-24.04
|
|
steps:
|
|
- name: Git checkout
|
|
uses: actions/checkout@v4
|
|
with:
|
|
fetch-depth: 0
|
|
|
|
- name: Set up Hugo
|
|
uses: peaceiris/actions-hugo@v2
|
|
with:
|
|
hugo-version: "0.122.0"
|
|
extended: true
|
|
|
|
- name: Set up Ruby 3.2.1
|
|
uses: ruby/setup-ruby@v1
|
|
env:
|
|
BUNDLE_GEMFILE: ${{ github.workspace }}/bin/dither/Gemfile
|
|
with:
|
|
ruby-version: 3.2.1
|
|
bundler-cache: true
|
|
|
|
- name: Add decryption key
|
|
env:
|
|
KEY: ${{ secrets.IMAGE_DECRYPTION_KEY }}
|
|
run: |
|
|
echo "$KEY" > ${{ github.workspace }}/secret.key
|
|
|
|
- name: Start dither server
|
|
env:
|
|
ROOT: ${{ github.workspace }}/content
|
|
KEY: ${{ github.workspace }}/secret.key
|
|
run: cd bin/dither && bundle exec ruby dither.rb >> dither.log 2>&1 &
|
|
|
|
# - name: Cache Hugo build
|
|
# uses: actions/cache@v3
|
|
# with:
|
|
# path: ${{ github.workspace }}/.cache
|
|
# key: hugo_cache
|
|
|
|
- name: Generate static site
|
|
env:
|
|
HUGO_CACHEDIR: ${{ github.workspace}}/.cache
|
|
DITHER_SERVER: http://localhost:4567
|
|
run: |
|
|
source bin/get-last-commit.sh
|
|
timeout 30 hugo --minify || echo "timeout!"
|
|
find public -name "*.enc" -type f -delete
|
|
|
|
# - name: Install SSH deploy key
|
|
# if: ${{ github.ref == 'refs/heads/main' }}
|
|
# env:
|
|
# DEPLOY_KEY: ${{ secrets.CI_DEPLOY_KEY }}
|
|
# SERVER_IP: ${{ secrets.SERVER_IP }}
|
|
# run: |
|
|
# mkdir -p ~/.ssh
|
|
# chmod 700 ~/.ssh
|
|
# echo "$DEPLOY_KEY" > ~/.ssh/id_rsa
|
|
# chmod 600 ~/.ssh/id_rsa
|
|
# ssh-keyscan $SERVER_IP > ~/.ssh/known_hosts
|
|
|
|
# - name: Deploy
|
|
# if: ${{ github.ref == 'refs/heads/main' }}
|
|
# env:
|
|
# SERVER_IP: ${{ secrets.SERVER_IP }}
|
|
# run: |
|
|
# rsync --version
|
|
# rsync \
|
|
# -v \
|
|
# -r \
|
|
# --delete \
|
|
# public/* \
|
|
# www-data@$SERVER_IP:/var/www/davideisinger.com
|
|
|
|
- name: Upload dither.log
|
|
uses: actions/upload-artifact@v3
|
|
with:
|
|
name: dither.log
|
|
path: bin/dither/dither.log
|