diff --git a/.github/workflows/post_release.yaml b/.github/workflows/post_release.yaml new file mode 100644 index 0000000000..f85407e6eb --- /dev/null +++ b/.github/workflows/post_release.yaml @@ -0,0 +1,65 @@ +name: Post Release Automation + +on: + release: + types: [published] + +permissions: + contents: write + pull-requests: write + +jobs: + update-version: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + + - name: Configure git user for actions + run: | + git config --global user.email "action@github.com" + git config --global user.name "GitHub Action" + + - name: Set environment variables + run: | + echo "NEW_VERSION=${{ github.event.release.tag_name }}" >> $GITHUB_ENV + echo "NEW_BRANCH=release-${{ github.event.release.tag_name }}" >> $GITHUB_ENV + echo "COMMIT_MSG=feat(docs|fw): post ${{ github.event.release.tag_name }} release changes" >> $GITHUB_ENV + + - name: Bump version in setup configuration + run: | + sed -i "s/^version = .*/version = $NEW_VERSION/" setup.cfg + git add setup.cfg + + - name: Update changelog with release details + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + RELEASE_DATE: $(date +'%Y-%m-%d') + run: | + # Replace unreleased link with the new release information + RELEASE_DATE=$(date +'%Y-%m-%d') + ESCAPED_LINK="https:\/\/github.com\/ethereum\/execution-spec-tests\/releases\/tag\/${NEW_VERSION}" + RELEASE_NAME=$(gh release view ${NEW_VERSION} --json body -q '.body' | grep '^#' | head -n 1 | sed 's/^# //') + sed -i "s/^## ๐Ÿ”œ \[Unreleased\].*/## [${NEW_VERSION}](${ESCAPED_LINK}) - ${RELEASE_DATE}: ${RELEASE_NAME}/" docs/CHANGELOG.md + + # Append changelog template for the new unreleased section + { echo ""; tail -n +5 docs/changelog_section_template.md; } > temp_template.md + sed -i '/\*\*Key:\*\*/ r temp_template.md' docs/CHANGELOG.md + rm temp_template.md + + git add docs/CHANGELOG.md + + - name: Create pull request with relevant changes + uses: peter-evans/create-pull-request@v4 + with: + token: ${{ secrets.GITHUB_TOKEN }} + branch: ${{ env.NEW_BRANCH }} + commit-message: ${{ env.COMMIT_MSG }} + title: ${{ env.COMMIT_MSG }} + body: | + ## ๐Ÿ—’๏ธ Description + Post ${{ env.NEW_VERSION }} release changes: + - Bump version within `setup.cfg`. + - Update `CHANGELOG.md` and copy in `changelog_section_template.md`. + base: main \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml deleted file mode 100644 index a892160dc1..0000000000 --- a/.github/workflows/release.yaml +++ /dev/null @@ -1,24 +0,0 @@ -name: Post Release Jobs - -on: - release: - types: [published] - -jobs: - update-version: - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - # TODO: add changelog entry updates - - name: Update version in setup.cfg - run: | - NEW_VERSION=$(echo ${{ github.event.release.tag_name }} | sed 's/^v//') - sed -i "s/^version = .*/version = $NEW_VERSION/" setup.cfg - - - name: Commit and push changes - run: | - git config --global user.email "action@github.com" - git config --global user.name "GitHub Action" - git add setup.cfg - git commit -m "Release EEST `${{ github.event.release.tag_name }}`" - git push origin HEAD:${{ github.ref }} \ No newline at end of file diff --git a/docs/changelog_section_template.md b/docs/changelog_section_template.md index 8cbaf9326c..e7bd6f0afb 100644 --- a/docs/changelog_section_template.md +++ b/docs/changelog_section_template.md @@ -2,7 +2,7 @@ The following can be copy-pasted into the `CHANGELOG.md` file for a new release. -## ๐Ÿ”œ [Unreleased] +## ๐Ÿ”œ [Unreleased](https://github.com/ethereum/execution-spec-tests/releases/tag/version) - 2024-xx-xx ### ๐Ÿงช Test Cases