Publish Cloud Version Dispatcher #881
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Publish Cloud Version Dispatcher | |
| on: | |
| workflow_dispatch: | |
| jobs: | |
| release_notes_docs_cloud_latest: | |
| name: Release notes cloud with latest version | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v6 | |
| with: | |
| token: ${{ secrets.GH_ACCESS_TOKEN }} | |
| repository: layer5io/docs | |
| - name: Get Latest Cloud Release | |
| id: meshery-cloud | |
| env: | |
| ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
| run: | | |
| release_tag=$(curl -sL -H "Authorization: token $ACCESS_TOKEN" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/layer5io/meshery-cloud/releases/latest | jq -r ".tag_name") | |
| echo "release_tag=$release_tag" >> $GITHUB_OUTPUT | |
| current_tag=$(<build/meshery-cloud.version) | |
| echo "current_tag=$current_tag" >> $GITHUB_OUTPUT | |
| - name: Get Release Info | |
| if: steps.meshery-cloud.outputs.current_tag != steps.meshery-cloud.outputs.release_tag | |
| env: | |
| ACCESS_TOKEN: ${{ secrets.GH_ACCESS_TOKEN }} | |
| run: | | |
| curl -sL -H "Authorization: token $ACCESS_TOKEN" -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/layer5io/meshery-cloud/releases/latest > latest_release.json | |
| export RELEASE_TAG=$( cat latest_release.json | jq '.["tag_name"]' | tr -d '"') | |
| export PRERELEASE=$( cat latest_release.json | jq '.["prerelease"]' | tr -d '"') | |
| export RELEASE_BODY=$( cat latest_release.json | jq '.["body"]' | tr -d '"') | |
| export DATE=$( cat latest_release.json | jq '.["published_at"]' | tr -d '"') | |
| printf '%b\n' "---\ntitle: $RELEASE_TAG\ndate: $DATE\ntag: $RELEASE_TAG\nprerelease: $PRERELEASE\ntoc_hide: true\n---\n\n$RELEASE_BODY" > ./content/en/cloud/reference/releases/$RELEASE_TAG.md | |
| - name: Update current release version | |
| if: steps.meshery-cloud.outputs.current_tag != steps.meshery-cloud.outputs.release_tag | |
| run: | | |
| echo ${{ steps.meshery-cloud.outputs.release_tag }} > build/meshery-cloud.version | |
| - name: Commit changes | |
| if: steps.meshery-cloud.outputs.current_tag != steps.meshery-cloud.outputs.release_tag | |
| uses: stefanzweifel/git-auto-commit-action@v7 | |
| with: | |
| commit_message: "Release Notes Cloud version ${{ steps.meshery-cloud.outputs.release_tag }}" | |
| branch: master | |
| commit_options: "--signoff" | |
| file_pattern: 'build/meshery-cloud.version ./content/en/cloud/reference/releases/${{ steps.meshery-cloud.outputs.release_tag }}.md' | |
| commit_user_name: l5io | |
| commit_user_email: ci@layer5.io | |
| commit_author: ${{ github.actor }} <${{ github.actor }}@users.noreply.github.com> | |
| # The checkout above is pinned to the SHA this run was dispatched at, | |
| # so anything landing on master while the job runs - notably the | |
| # cross-repo chart publisher in layer5io/meshery-cloud - leaves this | |
| # job pushing from a stale base and the release notes are lost with | |
| # the rejected push. Replay this commit on the current tip first. | |
| # Safe to rebase: this job only touches build/meshery-cloud.version | |
| # and its own release-notes page, which nothing else writes. | |
| # The action passes its identity per-command and never configures it, | |
| # so the rebase has to be handed the same one or it picks up whatever | |
| # the runner guesses. | |
| before_push_hook: >- | |
| git -c user.name="$INPUT_COMMIT_USER_NAME" -c user.email="$INPUT_COMMIT_USER_EMAIL" | |
| pull --rebase --autostash origin "$INPUT_BRANCH" |