From 5d9b3c7e617b1b61fcc1746e5365ca6c81966900 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sat, 10 Aug 2024 18:12:34 +0100 Subject: [PATCH] Fully automate release process --- .github/changes-template.md | 13 +++++++++++++ .github/workflows/release.yaml | 24 ++++++++++++++++++++++++ README.md | 16 +++------------- 3 files changed, 40 insertions(+), 13 deletions(-) create mode 100644 .github/changes-template.md diff --git a/.github/changes-template.md b/.github/changes-template.md new file mode 100644 index 00000000..86642624 --- /dev/null +++ b/.github/changes-template.md @@ -0,0 +1,13 @@ +## Development Version + +These endpoints have been added or updated since the last release. + +There are likely to be descriptions etc outside of the list below, but new query parameters, changes to headers, new endpoints should be listed. + +| Endpoint | [Lighthouse](https://github.com/sigp/lighthouse) | [Lodestar](https://github.com/ChainSafe/lodestar) | [Nimbus](https://github.com/status-im/nimbus-eth2) | [Prysm](https://github.com/prysmaticlabs/prysm) | [Teku](https://github.com/ConsenSys/teku) | +|---------------------------------------------------------------------------------------------------------------------|--------------------------------------------------|---------------------------------------------------|----------------------------------------------------|-------------------------------------------------|-------------------------------------------| + +The Following are no longer in the Standard API, removed since the latest version. + +| Endpoint | [Lighthouse](https://github.com/sigp/lighthouse) | [Lodestar](https://github.com/ChainSafe/lodestar) | [Nimbus](https://github.com/status-im/nimbus-eth2) | [Prysm](https://github.com/prysmaticlabs/prysm) | [Teku](https://github.com/ConsenSys/teku) | +|----------------------------------------------------------------------------------------------------------|--------------------------------------------------|---------------------------------------------------|----------------------------------------------------|-------------------------------------------------|-------------------------------------------| diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index d63a9569..9a7fc3e0 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -12,10 +12,33 @@ jobs: - uses: actions/checkout@v4 - uses: actions/setup-node@v4 - run: npm i -g @apidevtools/swagger-cli@4 + - name: Update Spec version + run: "sed -i 's/version: \"Dev/version: \"${{ github.ref_name }}/' ./beacon-node-oapi.yaml" - name: Bundle yaml spec run: "swagger-cli bundle ./beacon-node-oapi.yaml -r -t yaml -o ./deploy/beacon-node-oapi.yaml" - name: Bundle json spec run: "swagger-cli bundle ./beacon-node-oapi.yaml -r -t json -o ./deploy/beacon-node-oapi.json" + - name: Update index.html + run: | + sed -i "/urls:/a \ {url: \"./releases/${{ github.ref_name }}/beacon-node-oapi.json\", name: \"${{ github.ref_name }}\"}," ./index.html + - name: Update Changelog + run: | + sed -i "s/## Development Version/## ${{ github.ref_name }}/" ./CHANGES.md + awk '/# Recent Changes/ {print; print ""; system("cat .github/changes-template.md"); next}1' CHANGES.md > temp && mv temp CHANGES.md + - name: Create Release Notes + run: | + echo "The following changes are included in this release:" > release-notes.md + awk '/^## ${{ github.ref_name }}/ {flag=1; next} /^## / {flag=0} flag {if ($0 ~ /\| \[#/) {sub(/^\| /, "- "); sub(/\| .*$/, ""); sub(/[[:space:]]+$/, ""); print}}' CHANGES.md >> release-notes.md + - name: Create Pull Request + uses: peter-evans/create-pull-request@v6 + with: + token: ${{ secrets.GITHUB_TOKEN }} + commit-message: "Release ${{ github.ref_name }}" + branch: release-${{ github.ref_name }} + title: "Release ${{ github.ref_name }}" + body-path: "release-notes.md" + base: master + add-paths: index.html,CHANGES.md - name: Create Release id: create_release uses: softprops/action-gh-release@v2 @@ -24,6 +47,7 @@ jobs: with: name: ${{ github.ref_name }} tag_name: ${{ github.ref_name }} + body_path: "release-notes.md" draft: false prerelease: false files: | diff --git a/README.md b/README.md index df41a324..84de975d 100644 --- a/README.md +++ b/README.md @@ -68,16 +68,6 @@ redocly lint beacon-node-oapi.yaml ## Releasing -1. Create and push tag - - - Make sure `info.version` in `beacon-node-oapi.yaml` file is updated before tagging. This will need to be a PR, and will get the release process started. - - CD will create github release and upload bundled spec file - -2. Create a second PR, containing the updated `index.html`. Also change back the `info.version` in `beacon-node-api.yaml` back to `Dev` - - - The `index.html` file needs a new release entrypoint added to refer to the new release. Find the `urls` field, - and add the new release as the first entry in the list. - Entry should be in following format(replace `` with real tag name from step 1.): -``` - {url: "./releases//beacon-node-oapi.json", name: ""}, -``` +- Create and push a tag with the version of the release +- CD will create the github release, upload bundled spec files and create a PR to update files +- Review, approve and merge release PR to `master` branch