Skip to content

Commit

Permalink
Fully automate release process
Browse files Browse the repository at this point in the history
  • Loading branch information
nflaig committed Aug 10, 2024
1 parent 5354eaf commit 1e1a22f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 13 deletions.
13 changes: 13 additions & 0 deletions .github/changes-template.md
Original file line number Diff line number Diff line change
@@ -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) |
|----------------------------------------------------------------------------------------------------------|--------------------------------------------------|---------------------------------------------------|----------------------------------------------------|-------------------------------------------------|-------------------------------------------|
25 changes: 25 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,34 @@ 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
Expand All @@ -24,6 +48,7 @@ jobs:
with:
name: ${{ github.ref_name }}
tag_name: ${{ github.ref_name }}
body_path: "release-notes.md"
draft: false
prerelease: false
files: |
Expand Down
16 changes: 3 additions & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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 `<tag>` with real tag name from step 1.):
```
{url: "./releases/<tag>/beacon-node-oapi.json", name: "<tag>"},
```
- Create and push a tag with the version of the release
- CD will create the github release, upload bundled spec files and open a release PR
- Review, approve and merge the release PR to `master` branch

0 comments on commit 1e1a22f

Please sign in to comment.