From 5d58ae8411718471d67d5b78d9364caf20cae944 Mon Sep 17 00:00:00 2001 From: Adora Laura Kalb Date: Wed, 6 Nov 2024 11:01:37 +0100 Subject: [PATCH] ci: make it more versatile --- .woodpecker/docker-deploy.yaml | 48 +++++++++++++++++++++++++--------- 1 file changed, 36 insertions(+), 12 deletions(-) diff --git a/.woodpecker/docker-deploy.yaml b/.woodpecker/docker-deploy.yaml index e63c832..04564bf 100644 --- a/.woodpecker/docker-deploy.yaml +++ b/.woodpecker/docker-deploy.yaml @@ -1,3 +1,11 @@ +variables: + - &docker_repo 'adoralaura/humble-bot' + - &docker_registry 'https://index.docker.io/v1/' + - &docker_username 'adoralaura' + - &docker_platforms_testing 'linux/arm64/v8,linux/amd64' + - &docker_platforms_release 'linux/arm/v7,linux/arm64/v8,linux/amd64' + - &docker_dockerfile 'Dockerfile' + steps: - name: go-lint image: golangci/golangci-lint @@ -16,8 +24,8 @@ steps: # settings: # dockerfile: Dockerfile # platforms: linux/arm/v7,linux/arm64/v8,linux/amd64 -# repo: adoralaura/humble-bot -# registry: https://index.docker.io/v1/ +# repo: docker_repo +# registry: *docker_registry # tags: latest # username: adoralaura # password: @@ -28,12 +36,12 @@ steps: - event: tag image: woodpeckerci/plugin-docker-buildx settings: - dockerfile: Dockerfile - platforms: linux/arm/v7,linux/arm64/v8,linux/amd64 - repo: adoralaura/humble-bot - registry: https://index.docker.io/v1/ + dockerfile: *docker_dockerfile + platforms: *docker_platforms_release + repo: *docker_repo + registry: *docker_registry auto_tag: true - username: adoralaura + username: *docker_username password: from_secret: dockerhub_token @@ -45,11 +53,27 @@ steps: branch: main image: woodpeckerci/plugin-docker-buildx settings: - dockerfile: Dockerfile - platforms: linux/arm64/v8,linux/amd64 - repo: adoralaura/humble-bot - registry: https://index.docker.io/v1/ + dockerfile: *docker_dockerfile + platforms: *docker_platforms_testing + repo: *docker_repo + registry: *docker_registry tags: unstable - username: adoralaura + username: *docker_username + password: + from_secret: dockerhub_token + + - name: docker-deploy-pr + depends_on: + - go-lint + when: + - event: pull_request + image: woodpeckerci/plugin-docker-buildx + settings: + dockerfile: *docker_dockerfile + platforms: *docker_platforms_testing + repo: *docker_repo + registry: *docker_registry + tag: pull-${CI_COMMIT_PULL_REQUEST} + username: *docker_username password: from_secret: dockerhub_token