From a5df67758b375af9efc8157d2b557691c3af1240 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Thu, 25 Aug 2022 08:39:00 +0200 Subject: [PATCH 1/4] chore: rename workflow to improve intent Signed-off-by: heitorlessa --- .github/workflows/{publish.yml => on_release_notes.yml} | 0 1 file changed, 0 insertions(+), 0 deletions(-) rename .github/workflows/{publish.yml => on_release_notes.yml} (100%) diff --git a/.github/workflows/publish.yml b/.github/workflows/on_release_notes.yml similarity index 100% rename from .github/workflows/publish.yml rename to .github/workflows/on_release_notes.yml From 4ed903391e4a1f0263f64570963fbdafe7cda65b Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Thu, 25 Aug 2022 08:47:35 +0200 Subject: [PATCH 2/4] fix(ci): prevent concurrent git update failing push Signed-off-by: heitorlessa --- .github/workflows/reusable_publish_changelog.yml | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/.github/workflows/reusable_publish_changelog.yml b/.github/workflows/reusable_publish_changelog.yml index 9bd0959d1c8..2cb786ed86a 100644 --- a/.github/workflows/reusable_publish_changelog.yml +++ b/.github/workflows/reusable_publish_changelog.yml @@ -6,6 +6,9 @@ on: permissions: contents: write +env: + BRANCH: develop + jobs: publish_changelog: # Force Github action to run only a single job at a time (based on the group name) @@ -23,11 +26,13 @@ jobs: git config user.name "Release bot" git config user.email "aws-devax-open-source@amazon.com" git config pull.rebase true - git pull --rebase + git config remote.origin.url >&- || git remote add origin https://github.com/$origin # Git Detached mode (release notes) doesn't have origin + git pull origin $BRANCH - name: "Generate latest changelog" run: make changelog - name: Update Changelog in trunk run: | git add CHANGELOG.md git commit -m "update changelog with latest changes" - git push origin HEAD:refs/heads/develop + git pull origin $BRANCH # prevents concurrent branch update failing push + git push origin HEAD:refs/heads/$BRANCH From f6f79914104969ee2a86a0ffcfbefa210a86d7e9 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Thu, 25 Aug 2022 08:56:48 +0200 Subject: [PATCH 3/4] chore(ci): ensure docs have latest tip; re-enable changelog Signed-off-by: heitorlessa --- .github/workflows/on_release_notes.yml | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/.github/workflows/on_release_notes.yml b/.github/workflows/on_release_notes.yml index 16e51a5f542..563d1fefc79 100644 --- a/.github/workflows/on_release_notes.yml +++ b/.github/workflows/on_release_notes.yml @@ -20,6 +20,9 @@ name: Publish to PyPi # See MAINTAINERS.md "Releasing a new version" for release mechanisms +env: + BRANCH: develop + on: release: types: [published] @@ -101,17 +104,14 @@ jobs: aws ssm put-parameter --name "powertools-python-release-version" --value $RELEASE_VERSION --overwrite aws codepipeline start-pipeline-execution --name ${{ secrets.AWS_SAR_PIPELINE_NAME }} - # NOTE: `event` type brings a detached head failing git setup - # and reusable workflows only work as a standalone job - # meaning we need to research for a solution that works for non-detached and detached mode - # changelog: - # needs: release - # permissions: - # contents: write - # uses: ./.github/workflows/reusable_publish_changelog.yml + changelog: + needs: release + permissions: + contents: write + uses: ./.github/workflows/reusable_publish_changelog.yml docs: - needs: release + needs: [release, changelog] permissions: contents: write pages: write @@ -122,10 +122,13 @@ jobs: - uses: actions/checkout@v3 with: fetch-depth: 0 - - name: Setup git client + - name: Git client setup and refresh tip run: | git config user.name "Release bot" - git config user.email aws-devax-open-source@amazon.com + git config user.email "aws-devax-open-source@amazon.com" + git config pull.rebase true + git config remote.origin.url >&- || git remote add origin https://github.com/$origin # Git Detached mode (release notes) doesn't have origin + git pull origin $BRANCH - name: Install poetry run: pipx install poetry - name: Set up Python From 7577140dbe4f07a521bf854c5c2761cbeacd1f72 Mon Sep 17 00:00:00 2001 From: heitorlessa Date: Thu, 25 Aug 2022 08:59:12 +0200 Subject: [PATCH 4/4] feat(ci): create adhoc changelog workflow Signed-off-by: heitorlessa --- .github/workflows/build_changelog.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) create mode 100644 .github/workflows/build_changelog.yml diff --git a/.github/workflows/build_changelog.yml b/.github/workflows/build_changelog.yml new file mode 100644 index 00000000000..f0501083048 --- /dev/null +++ b/.github/workflows/build_changelog.yml @@ -0,0 +1,10 @@ +# Standalone workflow to update changelog if necessary +name: Build changelog + +on: + workflow_dispatch: + +jobs: + changelog: + needs: release + uses: ./.github/workflows/reusable_publish_changelog.yml