Commit graph

15 commits

Author SHA1 Message Date
Oliver Davies 3c7db24f1c ci: re-add deploy job
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
2022-09-30 00:20:19 +01:00
Oliver Davies 7baf281e8a ci: start replacing run with just 2022-09-29 23:19:08 +01:00
Oliver Davies 3c5c0e808a refactor: move into a website directory 2022-07-13 20:32:26 +01:00
Oliver Davies 4ad11a6963 ci: remove the old deploy steps 2022-02-26 22:19:59 +00:00
Oliver Davies 84536d0508 refactor: rename docker commands to ci 2021-11-09 17:38:27 +00:00
Oliver Davies fb1ba4236a ci: create .env file 2021-10-31 16:41:27 +00:00
Oliver Davies 6a3f3eaa99 build: add run script 2021-10-24 02:07:18 +01:00
Oliver Davies 9fcfb9874b ci: Re-run on schedule or manually 2021-08-17 20:43:06 +01:00
Oliver Davies 8576b027c9 ci: Ignore README.md 2021-08-17 20:41:39 +01:00
Oliver Davies 2c2e9838fe Run deployment target 2021-08-02 21:48:06 +01:00
Oliver Davies 7a0822da2e Rename main.yml to ci.yml 2021-07-27 09:40:33 +01:00
Oliver Davies 936d765115 GitHub Actions security hardening
Use commit SHAs for third-party actions to ensure that the same versions
are always being downloaded.
2021-07-16 09:51:20 +01:00
Oliver Davies cd4b23cad4 Use Makefile 2021-07-16 01:18:49 +01:00
Oliver Davies 5d3eb4aca9 Split commands for building and pushing images 2021-07-09 22:43:07 +01:00
Oliver Davies f1a9239ffc Build and push Docker images using GitHub Actions 2021-07-09 22:14:39 +01:00