diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index e4202a6..c0598b0 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -14,7 +14,7 @@ env:
DOCKER_TAG: ${{ github.sha }}
jobs:
- build-and-push-images:
+ build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@5a4ac9002d # v2.3.4
@@ -33,4 +33,22 @@ jobs:
- run: |
just push-images ${{ github.sha }}
+ deploy:
+ runs-on: ubuntu-latest
+ needs:
+ - build
+ steps:
+ - uses: actions/checkout@5a4ac9002d # v2.3.4
+ - uses: extractions/setup-just@95b912dc5d # 1.5.0
+
+ - name: Add the deployment SSH key
+ uses: shimataro/ssh-key-action@3c9b0fc6f2 # 2.3.1
+ with:
+ key: ${{ secrets.SSH_PRIVATE_KEY }}
+ name: id_rsa
+ known_hosts: ${{ secrets.SSH_KNOWN_HOSTS }}
+
+ - run: |
+ just deploy ${{ github.sha }}
+
# vim: sw=2 ts=2
diff --git a/justfile b/justfile
index e4916d1..5afe23d 100644
--- a/justfile
+++ b/justfile
@@ -12,11 +12,11 @@ create-daily:
touch "${filepath}/${filename}"
eval "${EDITOR}" "${filepath}/${filename}"
-deploy:
+deploy sha:
rm -fr _deploy
docker container rm oliverdavies.uk-build || true
- docker image pull ghcr.io/opdavies/oliverdavies.uk-build
+ docker image pull ghcr.io/opdavies/oliverdavies.uk-build:{{ sha }}
docker container run --entrypoint sh --name oliverdavies.uk-build ghcr.io/opdavies/oliverdavies.uk-build
docker container cp oliverdavies.uk-build:/app/ _deploy
44 lines
1.2 KiB
Makefile
44 lines
1.2 KiB
Makefile
# https://github.com/casey/just
|
|
|
|
default:
|
|
just --list
|
|
|
|
create-daily:
|
|
#!/usr/bin/env bash
|
|
date="$(date +%Y-%m-%d)"
|
|
filepath="website/source/_daily_emails"
|
|
filename="${date}.md"
|
|
|
|
touch "${filepath}/${filename}"
|
|
eval "${EDITOR}" "${filepath}/${filename}"
|
|
|
|
deploy sha:
|
|
rm -fr _deploy
|
|
docker container rm oliverdavies.uk-build || true
|
|
|
|
docker image pull ghcr.io/opdavies/oliverdavies.uk-build:{{ sha }}
|
|
docker container run --entrypoint sh --name oliverdavies.uk-build ghcr.io/opdavies/oliverdavies.uk-build
|
|
docker container cp oliverdavies.uk-build:/app/ _deploy
|
|
|
|
tree _deploy
|
|
|
|
tree -L 2 _deploy
|
|
|
|
rsync -r -avhP --delete _deploy/* opdavies@104.248.165.137:/srv/oliverdavies.uk
|
|
|
|
build-images sha:
|
|
docker image build \
|
|
website \
|
|
-f website/Dockerfile \
|
|
--target production \
|
|
-t ghcr.io/opdavies/oliverdavies.uk-build:latest
|
|
|
|
docker image build \
|
|
website \
|
|
-f website/Dockerfile \
|
|
--target production \
|
|
-t ghcr.io/opdavies/oliverdavies.uk-build:{{ sha }}
|
|
|
|
push-images sha: (build-images sha)
|
|
docker image push ghcr.io/opdavies/oliverdavies.uk-build:latest
|
|
docker image push ghcr.io/opdavies/oliverdavies.uk-build:{{ sha }}
|