From 422e04b23c85845753c13400e5d0ba732ae6df00 Mon Sep 17 00:00:00 2001 From: Maciej Lebiest Date: Sun, 19 Nov 2023 12:57:30 +0100 Subject: [PATCH] rework images building workflow --- .gitea/workflows/amd64-image.yml | 34 --------------- .gitea/workflows/build-images.yml | 72 +++++++++++++++++++++++++++++++ 2 files changed, 72 insertions(+), 34 deletions(-) delete mode 100644 .gitea/workflows/amd64-image.yml create mode 100644 .gitea/workflows/build-images.yml diff --git a/.gitea/workflows/amd64-image.yml b/.gitea/workflows/amd64-image.yml deleted file mode 100644 index fe4e51b..0000000 --- a/.gitea/workflows/amd64-image.yml +++ /dev/null @@ -1,34 +0,0 @@ -name: Build neovim image -run-name: Build Neovim image yay -on: - push: - branches: [ "main" ] - schedule: - - cron: '30 3 */3 * *' - -jobs: - build-neovim: - runs-on: ubuntu-latest - steps: - - name: install actions deps - run: | - dnf install -y nodejs git - - name: Check out repository code - uses: actions/checkout@v3 - - run: podman build . --file Dockerfile --tag neovim:latest - - name: build image - run: podman login -u "${{ secrets.PACKAGES_USERNAME }}" -p "${{ secrets.PACKAGES_PASSWD }}" gitea.maciej.cloud - - name: Push image - run: | - IMAGE_NAME="neovim" - IMAGE_ID="gitea.maciej.cloud/packages/$IMAGE_NAME" - podman tag $IMAGE_NAME:latest $IMAGE_ID:latest - podman pull $IMAGE_ID:v1 - podman pull $IMAGE_ID:v2 - podman tag $IMAGE_ID:v2 $IMAGE_ID:v3 - podman tag $IMAGE_ID:v1 $IMAGE_ID:v2 - podman tag $IMAGE_ID:latest $IMAGE_ID:v1 - podman push $IMAGE_ID:latest - podman push $IMAGE_ID:v1 - podman push $IMAGE_ID:v2 - podman push $IMAGE_ID:v3 diff --git a/.gitea/workflows/build-images.yml b/.gitea/workflows/build-images.yml new file mode 100644 index 0000000..841ff33 --- /dev/null +++ b/.gitea/workflows/build-images.yml @@ -0,0 +1,72 @@ +name: Build neovim image +run-name: Build Neovim image yay +on: + push: + branches: [ "main" ] + schedule: + - cron: '30 3 */3 * *' + +jobs: + build-neovim-arm64: + runs-on: linux_arm64 + steps: + - name: install actions deps + run: | + dnf install -y nodejs git + - name: Check out repository code + uses: actions/checkout@v3 + - run: | + podman build . --file Dockerfile --tag gitea.maciej.cloud/packages/neovim:arm64 + - name: login to registry + run: | + podman login -u "${{ secrets.PACKAGES_USERNAME }}" -p "${{ secrets.PACKAGES_PASSWD }}" gitea.maciej.cloud + - name: Push image + run: | + IMAGE_NAME="neovim" + IMAGE_ID="gitea.maciej.cloud/packages/$IMAGE_NAME" + podman pull $IMAGE_ID:arm64-v1 + podman pull $IMAGE_ID:arm64-v2 + podman tag $IMAGE_ID:arm64-v2 $IMAGE_ID:arm64-v3 + podman tag $IMAGE_ID:arm64-v1 $IMAGE_ID:arm64-v2 + podman tag $IMAGE_ID:arm64 $IMAGE_ID:arm64-v1 + podman push $IMAGE_ID:arm64-v1 + podman push $IMAGE_ID:arm64-v2 + podman push $IMAGE_ID:arm64-v3 + build-neovim-amd64: + runs-on: linux_amd64 + steps: + - name: install actions deps + run: | + dnf install -y nodejs git + - name: Check out repository code + uses: actions/checkout@v3 + - run: | + podman build . --file Dockerfile --tag gitea.maciej.cloud/packages/neovim:amd64 + - name: login to registry + run: | + podman login -u "${{ secrets.PACKAGES_USERNAME }}" -p "${{ secrets.PACKAGES_PASSWD }}" gitea.maciej.cloud + - name: Push image + run: | + IMAGE_NAME="neovim" + IMAGE_ID="gitea.maciej.cloud/packages/$IMAGE_NAME" + podman pull $IMAGE_ID:amd64-v1 + podman pull $IMAGE_ID:amd64-v2 + podman tag $IMAGE_ID:amd64-v2 $IMAGE_ID:amd64-v3 + podman tag $IMAGE_ID:amd64-v1 $IMAGE_ID:amd64-v2 + podman tag $IMAGE_ID:amd64 $IMAGE_ID:amd64-v1 + podman push $IMAGE_ID:amd64-v1 + podman push $IMAGE_ID:amd64-v2 + podman push $IMAGE_ID:amd64-v3 + update-images-manifest: + runs-on: [ linux_amd64 ] + needs: + - build-neovim-arm64 + - build-neovim-amd64 + steps: + - name: login to registry + run: podman login -u "${{ secrets.PACKAGES_USERNAME }}" -p "${{ secrets.PACKAGES_PASSWD }}" gitea.maciej.cloud + - name: Create manifest and push + run: | + echo "Updating manifest for neovim"; + podman manifest create gitea.maciej.cloud/packages/neovim:latest gitea.maciej.cloud/packages/neovim:amd64-v1 gitea.maciej.cloud/packages/neovim:arm64-v1; + podman manifest push gitea.maciej.cloud/packages/neovim:latest gitea.maciej.cloud/packages/neovim:latest;