summary refs log tree commit diff
diff options
context:
space:
mode:
authorMichael Kaye <1917473+michaelkaye@users.noreply.github.com>2022-11-28 12:51:40 +0000
committerGitHub <noreply@github.com>2022-11-28 12:51:40 +0000
commit2dad42a9fb83aa1296d186f908f36cfadae8d546 (patch)
tree86d9d7352809bfc2288b25e311df13900a87ae01
parentBump serde_json from 1.0.88 to 1.0.89 (#14560) (diff)
downloadsynapse-2dad42a9fb83aa1296d186f908f36cfadae8d546.tar.xz
Push complement image to a docker registry (#14509)
* GHA workflow to build complement images of key branches.

* Add changelog.d

* GHA workflow to build complement images of key branches.

* Add changelog.d

* Update complement.yml

Remove special casing for michaelk branch.

* Update complement.yml

Should run on master, develop not main, develop

* Rename file to be more obvious

* Merge did not go correctly.

* Setup 5am builds of develop, limit to one run at once.

* Fix crontab---run once at 5AM, not very minute between 5 and 6

* Fix cron syntax again?

* Tweak workflow name

* Allow manual debug runs

* Tweak indentation

Ctrl-Alt-L in PyCharm

Co-authored-by: David Robertson <david.m.robertson1@gmail.com>
Co-authored-by: David Robertson <davidr@element.io>
Diffstat (limited to '')
-rw-r--r--.github/workflows/push_complement_image.yml68
-rw-r--r--changelog.d/14509.docker1
2 files changed, 69 insertions, 0 deletions
diff --git a/.github/workflows/push_complement_image.yml b/.github/workflows/push_complement_image.yml
new file mode 100644
index 0000000000..937bbcbad0
--- /dev/null
+++ b/.github/workflows/push_complement_image.yml
@@ -0,0 +1,68 @@
+# This task does not run complement tests, see tests.yaml instead.
+# This task does not build docker images for synapse for use on docker hub, see docker.yaml instead
+
+name: Store complement-synapse image in ghcr.io
+on:
+  push:
+    branches: [ "master" ]
+  schedule:
+    - cron: '0 5 * * *'
+  workflow_dispatch:
+    inputs:
+      branch:
+        required: true
+        default: 'develop'
+        type: choice
+        options:
+          - develop
+          - master
+
+# Only run this action once per pull request/branch; restart if a new commit arrives.
+# C.f. https://docs.github.com/en/actions/reference/workflow-syntax-for-github-actions#concurrency
+# and https://docs.github.com/en/actions/reference/context-and-expression-syntax-for-github-actions#github-context
+concurrency:
+  group: ${{ github.workflow }}-${{ github.ref }}
+  cancel-in-progress: true
+
+jobs:
+  build:
+    name: Build and push complement image
+    runs-on: ubuntu-latest
+    permissions:
+      contents: read
+      packages: write
+    steps:
+      - name: Checkout specific branch (debug build)
+        uses: actions/checkout@v3
+        if: 'github.event.type == "workflow_dispatch"'
+        with:
+          ref: ${{ inputs.branch }}
+      - name: Checkout clean copy of develop (scheduled build)
+        uses: actions/checkout@v3
+        if: 'github.event.type == "schedule"'
+        with:
+          ref: develop
+      - name: Checkout clean copy of master (on-push)
+        uses: actions/checkout@v3
+        if: 'github.event.type == "push"'
+        with:
+          ref: master
+      - name: Login to registry
+        uses: docker/login-action@v1
+        with:
+          registry: ghcr.io
+          username: ${{ github.actor }}
+          password: ${{ secrets.GITHUB_TOKEN }}
+      - name: Work out labels for complement image
+        id: meta
+        uses: docker/metadata-action@v1
+        with:
+          images: ghcr.io/${{ github.repository }}/complement-synapse
+      - name: Build complement image
+        run: scripts-dev/complement.sh --build-only
+      - name: Tag and push generated image
+        run: |
+          for TAG in ${{ steps.meta.outputs.tags }}; do 
+            docker tag complement-synapse:latest $TAG
+            docker push $TAG
+          done
diff --git a/changelog.d/14509.docker b/changelog.d/14509.docker
new file mode 100644
index 0000000000..ba8b02d0b6
--- /dev/null
+++ b/changelog.d/14509.docker
@@ -0,0 +1 @@
+Push complement-synapse docker images to ghcr.io repository.