From b0e78a933aec2f2511a8b5a3c6ab0183aeb3da22 Mon Sep 17 00:00:00 2001 From: Staffan Olsson Date: Wed, 29 May 2024 15:15:18 +0200 Subject: [PATCH] copies current images through actions --- .github/workflows/images.yaml | 58 +++++++++++++++++++++++++++++++++++ base/kustomization.yaml | 1 + 2 files changed, 59 insertions(+) create mode 100644 .github/workflows/images.yaml diff --git a/.github/workflows/images.yaml b/.github/workflows/images.yaml new file mode 100644 index 0000000..660d6bc --- /dev/null +++ b/.github/workflows/images.yaml @@ -0,0 +1,58 @@ +name: images + +on: + push: + branches: + - main + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + permissions: + packages: write + steps: + - + name: Checkout + uses: actions/checkout@v4 + - + name: Login to GitHub Container Registry + uses: docker/login-action@v3 + with: + registry: ghcr.io + username: ${{ github.repository_owner }} + password: ${{ secrets.GITHUB_TOKEN }} + - + uses: actions/setup-go@v5 + with: + go-version: 1.22 + - + uses: imjasonh/setup-crane@v0.3 + - + name: Get mariadb docker hub image + id: imageMariadbFrom + uses: mikefarah/yq@v4.44.1 + with: + cmd: yq '.images[0].name + ":" + .images[0].newTag' 'base/kustomization.yaml' + - + name: Get mariadb target image + id: imageMariadbTo + uses: mikefarah/yq@v4.44.1 + with: + cmd: yq '.images[0].newName + ":" + .images[0].newTag' 'base/kustomization.yaml' + - + name: Get exporter docker hub image + id: imageMariadbFrom + uses: mikefarah/yq@v4.44.1 + with: + cmd: yq '.images[1].name + ":" + .images[1].newTag' 'base/kustomization.yaml' + - + name: Get exporter target image + id: imageMariadbTo + uses: mikefarah/yq@v4.44.1 + with: + cmd: yq '.images[1].newName + ":" + .images[1].newTag' 'base/kustomization.yaml' + - + run: | + crane cp ${{ steps.imageMariadbFrom.outputs.result }} ${{ steps.imageMariadbTo.outputs.result }} + crane cp ${{ steps.imageExporterFrom.outputs.result }} ${{ steps.imageExporterTo.outputs.result }} diff --git a/base/kustomization.yaml b/base/kustomization.yaml index d8d63e9..0d7951f 100644 --- a/base/kustomization.yaml +++ b/base/kustomization.yaml @@ -13,4 +13,5 @@ images: newName: ghcr.io/yolean/mariadb newTag: 10.11.8-jammy@sha256:b4fef57eee430a8f78da9850264dfeebdbbac197122be85d746041aee35b2f2d - name: prom/mysqld-exporter + newName: ghcr.io/yolean/mysqld-exporter newTag: v0.14.0@sha256:eb6fe170738bf9181c51f5bc89f93adb26672ec49ffdcb22f55c24834003b45d