From 70eade71ae5ae217ad8669854812dab5f6eb8052 Mon Sep 17 00:00:00 2001 From: Brandon Pfeifer Date: Fri, 15 Jul 2022 11:55:09 -0400 Subject: [PATCH] chore: Publish CHANGELOG.md to S3 (#2705) --- .circleci/config.yml | 86 ++++++++++++++++++++++++++++++++------------ 1 file changed, 64 insertions(+), 22 deletions(-) diff --git a/.circleci/config.yml b/.circleci/config.yml index c60963758..97762eaed 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -164,7 +164,7 @@ jobs: - run_tests - deploy_nightly - nightly-changelog: + changelog: docker: - image: quay.io/influxdb/changelogger:0dbf37ba8a912460358d322dcad414b80ce074f2 steps: @@ -179,36 +179,74 @@ jobs: #TODO: delete contents of CHANGELOG.md in repo root and replace with link to changelog in S3 - store_artifacts: path: changelog_artifacts/ - #TODO: push changelog to S3 with aws-s3/copy (see influxdb .circleci/config.yml) + - persist_to_workspace: + root: . + paths: + - changelog_artifacts + + s3-publish-changelog: + parameters: + build_type: + type: string + docker: + - image: ubuntu:latest + steps: + - attach_workspace: + at: /tmp/workspace + - checkout + - run: + name: Publish CHANGELOG.md to S3 + command: | + export DEBIAN_FRONTEND=noninteractive + apt-get update + apt-get install -y awscli + + pushd /tmp/workspace/changelog_artifacts/ + + case "<< parameters.build_type >>" + in + nightly) + aws s3 cp CHANGELOG.md "s3://dl.influxdata.com/kapacitor/nightlies/CHANGELOG.md" + ;; + release) + aws s3 cp CHANGELOG.md "s3://dl.influxdata.com/kapacitor/releases/CHANGELOG.<< pipeline.git.tag >>.md" + ;; + esac + +release_filter: &release_filter + filters: + tags: + only: + - /^v[0-9]+(\.[0-9]+){2}(-(rc|beta)[0-9]+)?/ + branches: + ignore: /.*/ + +any_filter: &any_filter + filters: + tags: + only: /.*/ + branches: + only: /.*/ workflows: version: 2 build-and-deploy: jobs: - build: - filters: - tags: - only: /.*/ + <<: *any_filter - release: + <<: *release_filter requires: - build - filters: - tags: - only: - - /^v[0-9]+(\.[0-9]+){2}(-(rc|beta)[0-9]+)?/ - - /^.*test$/ - branches: - ignore: /.*/ - static_code_checks: - filters: - tags: - only: /.*/ - # FIXME: don't run nightly changelog update on merge (remove this section) - - nightly-changelog: - filters: - branches: - only: - - master + <<: *any_filter + - changelog: + <<: *any_filter + - s3-publish-changelog: + <<: *release_filter + build_type: release + requires: + - changelog nightly: triggers: - schedule: @@ -219,4 +257,8 @@ workflows: - master jobs: - nightly-build - - nightly-changelog + - changelog + - s3-publish-changelog: + build_type: nightly + requires: + - changelog