Skip to content

Build your personal knowledge base with Trilium Notes

ci(docker): mirror stable releases to the legacy triliumnext/notes image

Elian Dorana9b1f79e307b
diff --git a/.github/workflows/main-docker.yml b/.github/workflows/main-docker.yml
index b19e1d9579..0c0cb76b40 100644
--- a/.github/workflows/main-docker.yml
+++ b/.github/workflows/main-docker.yml
@@ -321,3 +321,11 @@ jobs:
echo ""
echo "=== DockerHub ==="
crane manifest "${{ env.DOCKERHUB_REGISTRY }}/${{ env.IMAGE_NAME }}:${REF_NAME}"
+
+ mirror_legacy:
+ name: Mirror to legacy repository
+ if: ${{ startsWith(github.ref, 'refs/tags/v') && !contains(github.ref, '-') }}
+ needs:
+ - merge
+ uses: ./.github/workflows/mirror-legacy-docker.yml
+ secrets: inherit
diff --git a/.github/workflows/mirror-legacy-docker.yml b/.github/workflows/mirror-legacy-docker.yml
new file mode 100644
index 0000000000..69782e91d1
--- /dev/null
+++ b/.github/workflows/mirror-legacy-docker.yml
@@ -0,0 +1,52 @@
+name: Mirror legacy Docker image
+
+# Copies a release image to the pre-rename Docker Hub repository, so installs that still
+# pull triliumnext/notes keep receiving updates.
+on:
+ workflow_call:
+ inputs:
+ tags:
+ type: string
+ default: "stable latest"
+ workflow_dispatch:
+ inputs:
+ source:
+ description: "Tag of ghcr.io/triliumnext/trilium to copy"
+ default: "stable"
+ tags:
+ description: "Space-separated tags to write on triliumnext/notes"
+ default: "mirror-test"
+
+permissions:
+ contents: read
+
+env:
+ SOURCE_IMAGE: ghcr.io/triliumnext/trilium
+ TARGET_IMAGE: docker.io/triliumnext/notes
+
+jobs:
+ mirror:
+ name: Mirror to triliumnext/notes
+ if: ${{ github.repository == vars.REPO_MAIN }}
+ runs-on: ubuntu-latest
+ steps:
+ - name: Set up crane
+ uses: imjasonh/setup-crane@feee3b6bb0d4c68370f256a4502498c9227e5c6b # v0.7
+
+ - name: Login to DockerHub
+ uses: docker/login-action@dbcb813823bdd20940b903addbd779551569679f # v4.6.0
+ with:
+ registry: docker.io
+ username: ${{ secrets.DOCKERHUB_USERNAME }}
+ password: ${{ secrets.DOCKERHUB_TOKEN }}
+
+ - name: Copy image
+ env:
+ SOURCE_TAG: ${{ inputs.source || 'stable' }}
+ TARGET_TAGS: ${{ inputs.tags }}
+ run: |
+ for TAG in ${TARGET_TAGS}; do
+ echo "Copying ${SOURCE_IMAGE}:${SOURCE_TAG} -> ${TARGET_IMAGE}:${TAG}"
+ crane copy "${SOURCE_IMAGE}:${SOURCE_TAG}" "${TARGET_IMAGE}:${TAG}"
+ crane manifest "${TARGET_IMAGE}:${TAG}" > /dev/null
+ done