1
Fork 0

Revert "remove drone, setup github actions, enable fly.io deploys"

This reverts commit 7ae35419fd.
main
Zachary Flower 5 months ago
parent bcdcb9f37b
commit 853057e8b4
  1. 91
      .drone.yml
  2. 14
      .github/workflows/build-and-deploy.yml

@ -0,0 +1,91 @@
kind: pipeline
type: docker
name: default
trigger:
branch:
- main
steps:
- name: restore-cache
image: drillster/drone-volume-cache
depends_on: [clone]
volumes:
- name: cache
path: /cache
settings:
restore: true
mount:
- ./.bundle
- name: build
image: ruby:2.7
depends_on: [restore-cache]
commands:
- export BUNDLE_PATH="./.bundle"
- make install
- make http
- make gopher
- name: rebuild-cache
image: drillster/drone-volume-cache
depends_on: [build]
volumes:
- name: cache
path: /cache
settings:
rebuild: true
mount:
- ./.bundle
- name: degrade-images
image: ruby:2.7
depends_on: [clone]
commands:
- make degrade
- name: save-degraded-images
image: ruby:2.7
depends_on: [degrade-images]
commands:
- |
git config --local user.email "drone@crlf.wtf"
git config --local user.name "drone[bot]"
git add ./http/assets/posts
if [ -z "$(git status --porcelain)" ]; then
echo "::set-output name=push::false"
else
git commit -m "[SKIP CI] degraded newly added images"
echo "::set-output name=push::true"
git push origin main
fi
- name: deploy
image: ruby:2.7
depends_on: [build, degrade-images]
commands:
- apt update
- apt install rsync -y
- eval `ssh-agent -s`
- echo "$RSYNC_KEY" | ssh-add -
- mkdir -p ~/.ssh
- echo "Host *\n\tStrictHostKeyChecking no\n\n" > ~/.ssh/config
- rsync -rvc /drone/src/_http/ $RSYNC_USER@$RSYNC_HOST:$RSYNC_HTTP_PATH
- rsync -rvc /drone/src/_gopher/ $RSYNC_USER@$RSYNC_HOST:$RSYNC_GOPHER_PATH
environment:
RSYNC_KEY:
from_secret: rsync_key
RSYNC_USER:
from_secret: rsync_user
RSYNC_HOST:
from_secret: rsync_host
RSYNC_HTTP_PATH:
from_secret: rsync_http_path
RSYNC_GOPHER_PATH:
from_secret: rsync_gopher_path
volumes:
- name: cache
host:
path: /tmp/cache

@ -11,8 +11,18 @@ jobs:
name: build and deploy
steps:
- uses: actions/checkout@v2
- name: degrade images
run: make degrade
- name: degrade jpgs
shell: bash
run: |
cd ./http/assets/posts/
for f in *.jpg; do
if [ -f "${f%.jpg}-degraded.gif" ]; then
continue
fi
convert "${f}" -verbose -format GIF -interlace GIF -resize 640\> -colorspace gray -colors 4 -ordered-dither h8x8a -transparent white -set filename:f "%[t]-degraded" "%[filename:f].gif"
done
- name: commit changes
id: commit
shell: bash

Loading…
Cancel
Save