From ec276c088d1a20f6770bdb6abc01de4fc0f97794 Mon Sep 17 00:00:00 2001 From: Danny Bessems Date: Tue, 11 Jul 2023 15:15:41 +0200 Subject: [PATCH] build: Include semantic release (WIP) --- .drone.yml | 77 +++++++++++++++++++++++++++++++++++++++++++++--------- 1 file changed, 65 insertions(+), 12 deletions(-) diff --git a/.drone.yml b/.drone.yml index 971afc6..66ef3bb 100644 --- a/.drone.yml +++ b/.drone.yml @@ -1,12 +1,51 @@ kind: pipeline type: kubernetes -name: Container image +name: Container & Helm chart + +trigger: + event: + exclude: + - tag steps: -- name: Build & publish (Harbor) +- name: Semantic Release (Dry-run) + image: bv11-cr01.bessems.eu/proxy/library/node:20-slim + pull: always + commands: + - | + apt-get update + - | + apt-get install -y --no-install-recommends \ + git-core \ + ca-certificates + - | + npm install \ + semantic-release \ + @semantic-release/commit-analyzer \ + @semantic-release/exec \ + - | + export GIT_CREDENTIALS=$${GIT_USERNAME}:$${GIT_APIKEY} + - | + npx semantic-release \ + --package @semantic-release/exec \ + --package semantic-release \ + --branches ${DRONE_BRANCH} \ + --tag-format "v\$${version}" \ + --dry-run \ + --plugins @semantic-release/commit-analyzer,@semantic-release/exec \ + --analyzeCommits @semantic-release/commit-analyzer \ + --verifyRelease @semantic-release/exec \ + --verifyReleaseCmd 'echo "$${nextRelease.version}" > .version' + environment: + GIT_APIKEY: + from_secret: git_apikey + GIT_USERNAME: djpbessems + +- name: Build & publish container image (Harbor) depends_on: - - clone + - Semantic Release (Dry-run) image: plugins/kaniko + pull: always context: . settings: repo: bv11-cr01.bessems.eu/library/json-server @@ -16,10 +55,12 @@ steps: from_secret: harbor_username password: from_secret: harbor_password -- name: Build & publish (Dockerhub) + +- name: Build & publish container image (docker.io) depends_on: - - clone + - Semantic Release (Dry-run) image: plugins/kaniko + pull: always context: . settings: repo: index.docker.io/djpbessems/json-server @@ -30,15 +71,16 @@ steps: password: from_secret: docker_password ---- -kind: pipeline -type: kubernetes -name: Helm chart (Gitea) - -steps: -- name: Package & publish +- name: Package & publish helm chart (Gitea) + depends_on: + - Semantic Release (Dry-run) image: bv11-cr01.bessems.eu/proxy/alpine/helm + pull: always commands: + - | + echo '$MIRROR/alpine/edge/community' >> /etc/apk/repositories + apk update && apk add -y \ + yq - | helm package ./charts/json-server - | @@ -57,3 +99,14 @@ steps: GIT_APIKEY: from_secret: git_apikey GIT_USERNAME: djpbessems + +- name: Semantic Release + depends_on: + - Build & publish container image (Harbor) + - Build & publish container image (docker.io) + - Package & publish helm chart (Gitea) + image: bv11-cr01.bessems.eu/proxy/library/node:20-slim + pull: always + commands: + - | + echo 'foo'