From 97aaae6db1b4ee369616719cef9078eebe7c9f0c Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Wed, 7 Aug 2024 13:12:55 +0100 Subject: [PATCH 1/4] Add workflow to create pre-releases --- .github/workflows/pre-release.yaml | 46 ++++++++++++++++++++++++++++++ .github/workflows/release.yaml | 1 + README.md | 6 ++++ wordlist.txt | 1 + 4 files changed, 54 insertions(+) create mode 100644 .github/workflows/pre-release.yaml diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml new file mode 100644 index 00000000..19384548 --- /dev/null +++ b/.github/workflows/pre-release.yaml @@ -0,0 +1,46 @@ +name: Pre-release + +on: + push: + tags: + - "v*-alpha.*" + +jobs: + release: + runs-on: ubuntu-latest + steps: + - 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: Create Release + id: create_release + uses: softprops/action-gh-release@v2 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + with: + name: ${{ github.ref_name }} + tag_name: ${{ github.ref_name }} + draft: false + prerelease: true + files: | + ./deploy/beacon-node-oapi.yaml + ./deploy/beacon-node-oapi.json + fail_on_unmatched_files: true + - name: Rollback Release + if: failure() + uses: author/action-rollback@1.0.4 + with: + # Using a known release ID + release_id: ${{ steps.create_release.outputs.id }} + # Using a tag name + tag: ${{ github.ref }} + # Remove the tag if release process failed + delete_orphan_tag: true + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index eedf0e8a..a2f8b7b4 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,6 +4,7 @@ on: push: tags: - "v*" + - "!v*-alpha.*" jobs: release: diff --git a/README.md b/README.md index df41a324..e2f16cf0 100644 --- a/README.md +++ b/README.md @@ -81,3 +81,9 @@ redocly lint beacon-node-oapi.yaml ``` {url: "./releases//beacon-node-oapi.json", name: ""}, ``` + +### Pre-releases + +To create a pre-release, simply push a new tag with the suffix `-alpha.x`. The CD will create a github release and upload the bundled spec files. + +Pre-releases will not be listed in `index.html` and are intended to allow early testing against the spec. diff --git a/wordlist.txt b/wordlist.txt index 35f7a54d..bfb27ac7 100644 --- a/wordlist.txt +++ b/wordlist.txt @@ -23,6 +23,7 @@ MEV PayloadAttributesV Gwei prev +pre ENR enr attnets From fee9b36beada3b9ff642a8572d05a7701b631833 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Fri, 9 Aug 2024 09:52:01 +0100 Subject: [PATCH 2/4] Allow beta and rc pre-releases --- .github/workflows/pre-release.yaml | 2 +- .github/workflows/release.yaml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index 19384548..45a0a5cf 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -3,7 +3,7 @@ name: Pre-release on: push: tags: - - "v*-alpha.*" + - "v*-(alpha|beta|rc).*" jobs: release: diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index a2f8b7b4..b7f4ad4a 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -4,7 +4,7 @@ on: push: tags: - "v*" - - "!v*-alpha.*" + - "!v*-(alpha|beta|rc).*" jobs: release: From 14ce93c6121314e21cc424a246ad251276dd7218 Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sat, 10 Aug 2024 21:46:02 +0100 Subject: [PATCH 3/4] List changes in release notes --- .github/workflows/pre-release.yaml | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index 45a0a5cf..9a365572 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -18,6 +18,11 @@ jobs: 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: Create Release Notes + run: | + echo "The following changes are included in this release:" > release-notes.md + awk '/^## Development Version/ {flag=1; next} /^## / {flag=0} flag { \ + if ($0 ~ /\| \[#/) {sub(/^\| /, "- "); sub(/\| .*$/, ""); sub(/[[:space:]]+$/, ""); print}}' CHANGES.md >> release-notes.md - name: Create Release id: create_release uses: softprops/action-gh-release@v2 @@ -26,6 +31,7 @@ jobs: with: name: ${{ github.ref_name }} tag_name: ${{ github.ref_name }} + body_path: "release-notes.md" draft: false prerelease: true files: | From 9fa4a800e5f0aec514d961a29c625d77742f345c Mon Sep 17 00:00:00 2001 From: Nico Flaig Date: Sat, 10 Aug 2024 21:51:39 +0100 Subject: [PATCH 4/4] Remove unnecessary comments --- .github/workflows/pre-release.yaml | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/.github/workflows/pre-release.yaml b/.github/workflows/pre-release.yaml index 9a365572..aa919659 100644 --- a/.github/workflows/pre-release.yaml +++ b/.github/workflows/pre-release.yaml @@ -27,7 +27,7 @@ jobs: id: create_release uses: softprops/action-gh-release@v2 env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: name: ${{ github.ref_name }} tag_name: ${{ github.ref_name }} @@ -42,11 +42,8 @@ jobs: if: failure() uses: author/action-rollback@1.0.4 with: - # Using a known release ID release_id: ${{ steps.create_release.outputs.id }} - # Using a tag name tag: ${{ github.ref }} - # Remove the tag if release process failed delete_orphan_tag: true env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}