Commit cd447e4341b2133bdef9ba62c6ebea3316eb407c

Parents: fd5903b5fb171652011e522b9f333e8c277ad039

From: Moritz Poldrack <git@moritz.sh>
Date: Thu Nov 2 21:10:52 2023 +0700

ci: add docker image upload

		

Stats

.build.yml +15/-2

Changeset

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
diff --git a/.build.yml b/.build.yml
index ecb0f49ac8925a38b734f9fda0502cd05cc7d8cb..078e0411e99adc6bc2a2dfbd9f2927645526c294 100644
--- a/.build.yml
+++ b/.build.yml
@@ -17,6 +17,7 @@   - "https://git.sr.ht/~mpldr/uniview"
 secrets:
   - ba45943f-f792-4287-87a5-09fdb803a8dd # GitHub SSH Key
   - fb78c647-e9f5-4922-b804-7c795da4d56a # GitHub known_hosts
+  - 620e79ed-2089-4231-ba88-42a5bb352973 # Container push key
 tasks:
   - prepare: |
       sudo usermod -aG docker $(whoami)
@@ -45,9 +46,21 @@       if git status --porcelain | grep AUTHORS | grep "^ M" > /dev/null; then
         echo -e "\n\nAUTHORS file is not up to date!"
         exit 1
       fi
+  - stop-unless-push: |
+      if [ "$BUILD_SUBMITTER" != "git.sr.ht" ]; then complete-build; fi
   - mirror-to-github: |
-      cd uniview
-      [ $(git describe HEAD) == $(git describe origin/master) ] || exit 255
       git clone --mirror https://git.sr.ht/~mpldr/uniview
       cd uniview.git
       git push --mirror git@github.com:mpldr/uniview.git
+  - update-container: |
+      cd ~/uniview
+      if git describe --exact-match HEAD; then
+        docker build -t "c8n.io/mpldr/uniview:$(git describe --exact-match HEAD)" -t "c8n.io/mpldr/uniview:latest" -t "c8n.io/mpldr/uniview:devel" .
+        docker push "c8n.io/mpldr/uniview:$(git describe --exact-match HEAD)"
+        docker push "c8n.io/mpldr/uniview:latest"
+        docker push "c8n.io/mpldr/uniview:devel"
+      else
+        docker build -t "c8n.io/mpldr/uniview:$(git describe HEAD)" -t "c8n.io/mpldr/uniview:devel" .
+        docker push "c8n.io/mpldr/uniview:$(git describe --always HEAD)"
+        docker push "c8n.io/mpldr/uniview:devel"
+      fi