From ebc32664399ac1dac65c6474cc82ef433adc3300 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Thu, 6 Jan 2022 16:48:22 +0100 Subject: [PATCH 1/3] chore: action to automate release prep --- .github/workflows/release-prep.yml | 44 +++++++++++++++++++++++++----- 1 file changed, 37 insertions(+), 7 deletions(-) diff --git a/.github/workflows/release-prep.yml b/.github/workflows/release-prep.yml index a8de631b5..630601fc8 100644 --- a/.github/workflows/release-prep.yml +++ b/.github/workflows/release-prep.yml @@ -3,20 +3,50 @@ on: workflow_dispatch: inputs: targetRelease: - description: 'Release number to upgrade to. For example X.X.X' + description: 'Release number to upgrade to. For example X.X.X. Follow Semantic Versioning when deciding on next version.' required: true - previousRelease: - description: 'Current latest maven release' - required: false jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - name: Find and Replace ${{ github.event.inputs.previousRelease }} with ${{ github.event.inputs.targetRelease }} + - name: Get current date + id: date + run: echo "::set-output name=date::$(date +'%Y-%m-%d')" + - name: Set current release version env variable + run: | + echo "CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV + - name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} uses: jacobtomlinson/gha-find-replace@v2 with: - find: ${{ github.event.inputs.previousRelease }} + find: ${{ env.CURRENT_VERSION }} replace: ${{ github.event.inputs.targetRelease }} - regex: false \ No newline at end of file + regex: false + exclude: CHANGELOG.md + - name: Create changelog placeholder for ${{ github.event.inputs.targetRelease }} + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: '## [Unreleased]' + replace: | + ## [Unreleased] + + ## [${{ github.event.inputs.targetRelease }}] - ${{ steps.date.outputs.date }} + + + + regex: false + include: CHANGELOG.md + - name: Create Release Pull Request + uses: peter-evans/create-pull-request@v3 + with: + commit-message: chore:prep release ${{ github.event.inputs.targetRelease }} + token: ${{ secrets.RELEASE }} + signoff: false + branch: prep-release-${{ github.event.inputs.targetRelease }} + delete-branch: true + title: chore:Prep release ${{ github.event.inputs.targetRelease }} + body: | + This is automated release prep. Remember to update [CHANGELOG.md](https://github.com/awslabs/aws-lambda-powertools-java/blob/prep-release-${{ github.event.inputs.targetRelease }}/CHANGELOG.md) to capture changes in this release. Please review changes carefully before merging. + + * [ ] Updated CHANGELOG.md \ No newline at end of file From bf500cf0a30e57ece7b0ba65deadadb24e7136c9 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Thu, 6 Jan 2022 20:00:42 +0100 Subject: [PATCH 2/3] chore(docs): externalise powertools version from docs to macros --- docs/Dockerfile | 2 +- docs/index.md | 12 ++++++------ docs/utilities/batch.md | 4 ++-- docs/utilities/custom_resources.md | 4 ++-- docs/utilities/parameters.md | 6 +++--- docs/utilities/sqs_large_message_handling.md | 4 ++-- docs/utilities/validation.md | 4 ++-- mkdocs.yml | 4 ++++ 8 files changed, 22 insertions(+), 18 deletions(-) diff --git a/docs/Dockerfile b/docs/Dockerfile index 7bf267f4f..1524933ab 100644 --- a/docs/Dockerfile +++ b/docs/Dockerfile @@ -1,2 +1,2 @@ FROM squidfunk/mkdocs-material -RUN pip install mkdocs-git-revision-date-plugin +RUN pip install mkdocs-git-revision-date-plugin mkdocs-macros-plugin \ No newline at end of file diff --git a/docs/index.md b/docs/index.md index 86a638652..115edc566 100644 --- a/docs/index.md +++ b/docs/index.md @@ -46,17 +46,17 @@ For more information about the project and available options refer to this [repo software.amazon.lambda powertools-tracing - 1.10.1 + {{ powertools.version }} software.amazon.lambda powertools-logging - 1.10.1 + {{ powertools.version }} software.amazon.lambda powertools-metrics - 1.10.1 + {{ powertools.version }} ... @@ -114,9 +114,9 @@ For more information about the project and available options refer to this [repo } dependencies { - aspect 'software.amazon.lambda:powertools-logging:1.10.1' - aspect 'software.amazon.lambda:powertools-tracing:1.10.1' - aspect 'software.amazon.lambda:powertools-metrics:1.10.1' + aspect 'software.amazon.lambda:powertools-logging:{{ powertools.version }}' + aspect 'software.amazon.lambda:powertools-tracing:{{ powertools.version }}' + aspect 'software.amazon.lambda:powertools-metrics:{{ powertools.version }}' } ``` diff --git a/docs/utilities/batch.md b/docs/utilities/batch.md index 2fbfa73ae..ebb98b08b 100644 --- a/docs/utilities/batch.md +++ b/docs/utilities/batch.md @@ -32,7 +32,7 @@ To install this utility, add the following dependency to your project. software.amazon.lambda powertools-sqs - 1.10.1 + {{ powertools.version }} ... @@ -82,7 +82,7 @@ To install this utility, add the following dependency to your project. dependencies { ... - aspect 'software.amazon.lambda:powertools-sqs:1.10.1' + aspect 'software.amazon.lambda:powertools-sqs:{{ powertools.version }}' } ``` diff --git a/docs/utilities/custom_resources.md b/docs/utilities/custom_resources.md index 3bfd0ef8f..3cf75800f 100644 --- a/docs/utilities/custom_resources.md +++ b/docs/utilities/custom_resources.md @@ -24,7 +24,7 @@ To install this utility, add the following dependency to your project. software.amazon.lambda powertools-cloudformation - 1.10.1 + {{ powertools.version }} ``` @@ -33,7 +33,7 @@ To install this utility, add the following dependency to your project. ```groovy dependencies { ... - implementation 'software.amazon.lambda:powertools-cloudformation:1.10.1' + implementation 'software.amazon.lambda:powertools-cloudformation:{{ powertools.version }}' } ``` diff --git a/docs/utilities/parameters.md b/docs/utilities/parameters.md index f020d785d..e2d0cb965 100644 --- a/docs/utilities/parameters.md +++ b/docs/utilities/parameters.md @@ -24,7 +24,7 @@ To install this utility, add the following dependency to your project. software.amazon.lambda powertools-parameters - 1.10.1 + {{ powertools.version }} ``` === "Gradle" @@ -32,7 +32,7 @@ To install this utility, add the following dependency to your project. ```groovy dependencies { ... - aspect 'software.amazon.lambda:powertools-parameters:1.10.1' + aspect 'software.amazon.lambda:powertools-parameters:{{ powertools.version }}' } ``` @@ -433,6 +433,6 @@ If you want to use the ```@Param``` annotation in your project add configuration dependencies { ... - aspect 'software.amazon.lambda:powertools-parameters:1.10.1' + aspect 'software.amazon.lambda:powertools-parameters:{{ powertools.version }}' } ``` \ No newline at end of file diff --git a/docs/utilities/sqs_large_message_handling.md b/docs/utilities/sqs_large_message_handling.md index cb0a0c323..95dc34e35 100644 --- a/docs/utilities/sqs_large_message_handling.md +++ b/docs/utilities/sqs_large_message_handling.md @@ -40,7 +40,7 @@ To install this utility, add the following dependency to your project. software.amazon.lambda powertools-sqs - 1.10.1 + {{ powertools.version }} ... @@ -90,7 +90,7 @@ To install this utility, add the following dependency to your project. dependencies { ... - aspect 'software.amazon.lambda:powertools-sqs:1.10.1' + aspect 'software.amazon.lambda:powertools-sqs:{{ powertools.version }}' } ``` diff --git a/docs/utilities/validation.md b/docs/utilities/validation.md index 526e7c265..862e668c0 100644 --- a/docs/utilities/validation.md +++ b/docs/utilities/validation.md @@ -22,7 +22,7 @@ To install this utility, add the following dependency to your project. com.amazonaws powertools-validation - 1.10.1 + {{ powertools.version }} ... @@ -71,7 +71,7 @@ To install this utility, add the following dependency to your project. } dependencies { - aspect 'software.amazon.lambda:powertools-validation:1.10.1' + aspect 'software.amazon.lambda:powertools-validation:{{ powertools.version }}' } ``` diff --git a/mkdocs.yml b/mkdocs.yml index c99bf7d47..6ab16052d 100644 --- a/mkdocs.yml +++ b/mkdocs.yml @@ -65,6 +65,7 @@ copyright: Copyright © 2021 Amazon Web Services plugins: - git-revision-date - search + - macros extra_css: - stylesheets/extra.css @@ -72,6 +73,9 @@ extra_javascript: - javascript/aws-amplify.min.js - javascript/extra.js +extra: + powertools: + version: 1.10.1 repo_url: https://github.com/awslabs/aws-lambda-powertools-java edit_uri: edit/master/docs From d05c9915f7bb59241326f5c658241ab565966608 Mon Sep 17 00:00:00 2001 From: Pankaj Agrawal Date: Thu, 6 Jan 2022 20:12:13 +0100 Subject: [PATCH 3/3] chore: granular find and replace --- .github/workflows/release-prep.yml | 25 +++++++++++++++++++++++-- 1 file changed, 23 insertions(+), 2 deletions(-) diff --git a/.github/workflows/release-prep.yml b/.github/workflows/release-prep.yml index 630601fc8..8d0aa0579 100644 --- a/.github/workflows/release-prep.yml +++ b/.github/workflows/release-prep.yml @@ -17,13 +17,34 @@ jobs: - name: Set current release version env variable run: | echo "CURRENT_VERSION=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_ENV - - name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} + - name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in mkdocs.yml + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: 'version: ${{ env.CURRENT_VERSION }}' + replace: 'version: ${{ github.event.inputs.targetRelease }}' + regex: false + include: "mkdocs.yml" + - name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in pom.xml + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: ${{ env.CURRENT_VERSION }} + replace: ${{ github.event.inputs.targetRelease }} + regex: false + include: "**/*pom.xml" + - name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in build.gradle + uses: jacobtomlinson/gha-find-replace@v2 + with: + find: ${{ env.CURRENT_VERSION }} + replace: ${{ github.event.inputs.targetRelease }} + regex: false + include: "**/*build.gradle" + - name: Find and Replace ${{ env.CURRENT_VERSION }} with ${{ github.event.inputs.targetRelease }} in README.md uses: jacobtomlinson/gha-find-replace@v2 with: find: ${{ env.CURRENT_VERSION }} replace: ${{ github.event.inputs.targetRelease }} regex: false - exclude: CHANGELOG.md + include: "README.md" - name: Create changelog placeholder for ${{ github.event.inputs.targetRelease }} uses: jacobtomlinson/gha-find-replace@v2 with: