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 6d7a002
Show file tree
Hide file tree
Showing 4 changed files with 36 additions and 14 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) |
|----------------------------------------------------------------------------------------------------------|--------------------------------------------------|---------------------------------------------------|----------------------------------------------------|-------------------------------------------------|-------------------------------------------|
22 changes: 22 additions & 0 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,32 @@ 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 development_version_template.md"); next}1' CHANGES.md > temp && mv temp CHANGES.md
- name: Commit and push changes
run: |
git config --global user.name "github-actions[bot]"
git config --global user.email "github-actions[bot]@users.noreply.github.com"
git add index.html CHANGELOG.md
git commit -m "Release ${{ github.ref_name }}"
git push origin HEAD:master
- name: Move tag to release commit
run: |
git tag -d ${{ github.ref_name }}
git push --delete origin ${{ github.ref_name }}
git tag ${{ github.ref_name }}
git push origin ${{ github.ref_name }}
- name: Create Release
id: create_release
uses: softprops/action-gh-release@v2
Expand Down
1 change: 0 additions & 1 deletion CHANGES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
# Recent Changes


## Development Version

These endpoints have been added or updated since the last release.
Expand Down
14 changes: 1 addition & 13 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,16 +68,4 @@ 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. CD will create github release, upload bundled spec file and update other files like `index.html` and `CHANGES.md`.

0 comments on commit 6d7a002

Please sign in to comment.