From df66b6fadeeda9fa31f4aff5f411eb5e164ebf5c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Sat, 28 Jan 2023 11:58:45 +0100 Subject: [PATCH] build: check for release notes before release #448 --- .github/actions/check_milestone/action.yaml | 64 ++++++++++++--- .github/actions/deploy_site/action.yaml | 6 +- .github/actions/release_milestone/action.yaml | 78 ++++++++++++++----- ...deploy.yaml => docs-build-deployment.yaml} | 2 +- .../workflows/{build.yaml => docs-build.yaml} | 2 +- .../{release.yaml => version-release.yaml} | 2 +- .../content/basics/migration/_index.en.md | 4 +- exampleSite/content/more/credits/_index.en.md | 13 ++++ 8 files changed, 133 insertions(+), 38 deletions(-) rename .github/workflows/{deploy.yaml => docs-build-deployment.yaml} (96%) rename .github/workflows/{build.yaml => docs-build.yaml} (97%) rename .github/workflows/{release.yaml => version-release.yaml} (98%) diff --git a/.github/actions/check_milestone/action.yaml b/.github/actions/check_milestone/action.yaml index b01f39ca06..0c7b69d3c9 100644 --- a/.github/actions/check_milestone/action.yaml +++ b/.github/actions/check_milestone/action.yaml @@ -17,14 +17,17 @@ runs: - name: Get tag uniqueness id: unique_tag uses: mukunku/tag-exists-action@v1.2.0 # wildcard version @v1 not possible - with: - tag: ${{ env.MILESTONE }} env: MILESTONE: ${{ inputs.milestone }} + with: + tag: ${{ env.MILESTONE }} - name: Get closed issues for milestone id: closed_issues uses: octokit/graphql-action@v2.x + env: + MILESTONE: ${{ inputs.milestone }} + GITHUB_TOKEN: ${{ inputs.github_token }} with: query: | query { @@ -32,13 +35,13 @@ runs: issueCount } } - env: - MILESTONE: ${{ inputs.milestone }} - GITHUB_TOKEN: ${{ inputs.github_token }} - name: Get open issues for milestone id: open_issues uses: octokit/graphql-action@v2.x + env: + MILESTONE: ${{ inputs.milestone }} + GITHUB_TOKEN: ${{ inputs.github_token }} with: query: | query { @@ -46,15 +49,51 @@ runs: issueCount } } + + - name: Get old version number + id: oldvers + uses: andstor/file-reader-action@v1 + with: + path: layouts/partials/version.txt + + - name: Get old main version number + id: oldmainvers + uses: ashley-taylor/regex-property-action@v1 + with: + value: ${{ steps.oldvers.outputs.contents }} + regex: (\d+)\.(\d+)\.\d+.* + replacement: '$1\.$2' + + - name: Get current patch version number + id: patchvers + uses: ashley-taylor/regex-property-action@v1 env: MILESTONE: ${{ inputs.milestone }} - GITHUB_TOKEN: ${{ inputs.github_token }} + with: + value: ${{ env.MILESTONE }} + regex: \d+\.\d+\.(\d+) + replacement: "$1" + + - name: Get migration notes + id: migrationnotes + uses: andstor/file-reader-action@v1 + with: + path: exampleSite/content/basics/migration/_index.en.md + + - name: Check for old migration notes + id: hasoldnotes + uses: ashley-taylor/regex-property-action@v1 + with: + value: ${{ steps.migrationnotes.outputs.contents }} + regex: '.*?[\n\r\s]*[\n\r\s]*-*\s*[\n\r\s]*?[\n\r]+##\s+${{ steps.oldmainvers.outputs.value }}\.0\s+.*?[\n\r][\n\r\s]*.*' + flags: gs + replacement: '1' - name: Set outcome id: outcome shell: bash run: | - if [ "${{ fromJSON(steps.closed_issues.outputs.data).search.issueCount > 0 && fromJSON(steps.open_issues.outputs.data).search.issueCount == 0 && steps.unique_tag.outputs.exists == 'false' }}" = "true" ]; then + if [ "${{ fromJSON(steps.closed_issues.outputs.data).search.issueCount > 0 && fromJSON(steps.open_issues.outputs.data).search.issueCount == 0 && steps.unique_tag.outputs.exists == 'false' && ( (steps.patchvers.outputs.value!='0'&&steps.hasoldnotes.outputs.value=='1') || (steps.patchvers.outputs.value=='0'&&steps.hasoldnotes.outputs.value!='1') ) }}" = "true" ]; then echo "outcome=success" >> $GITHUB_OUTPUT else echo "outcome=failure" >> $GITHUB_OUTPUT @@ -63,10 +102,13 @@ runs: - name: Log results and exit shell: bash run: | - echo outcome : ${{ steps.outcome.outputs.outcome }} - echo has unique tag : ${{ steps.unique_tag.outputs.exists == 'false' }} - echo has closed issues: ${{ fromJSON(steps.closed_issues.outputs.data).search.issueCount > 0 }} - echo has open issues : ${{ fromJSON(steps.open_issues.outputs.data).search.issueCount > 0 }} + echo outcome : ${{ steps.outcome.outputs.outcome }} + echo has unique tag : ${{ steps.unique_tag.outputs.exists == 'false' }} + echo has closed issues : ${{ fromJSON(steps.closed_issues.outputs.data).search.issueCount > 0 }} + echo has open issues : ${{ fromJSON(steps.open_issues.outputs.data).search.issueCount > 0 }} + echo is patch version : ${{ steps.patchvers.outputs.value != '0' }} + echo has old main notes : ${{ steps.hasoldnotes.outputs.value == '1' }} + echo are notes okay : ${{ (steps.patchvers.outputs.value!='0'&&steps.hasoldnotes.outputs.value=='1') || (steps.patchvers.outputs.value=='0'&&steps.hasoldnotes.outputs.value!='1') }} if [ "${{ steps.outcome.outputs.outcome }}" = "failure" ]; then exit 1 fi diff --git a/.github/actions/deploy_site/action.yaml b/.github/actions/deploy_site/action.yaml index b03cae0508..e064e27ad5 100644 --- a/.github/actions/deploy_site/action.yaml +++ b/.github/actions/deploy_site/action.yaml @@ -9,9 +9,9 @@ runs: steps: - name: Deploy site uses: peaceiris/actions-gh-pages@v3 - with: - github_token: ${{ env.GITHUB_TOKEN }} - publish_dir: ${{ env.GITHUB_WORKSPACE }}/../public env: GITHUB_TOKEN: ${{ inputs.github_token }} GITHUB_WORKSPACE: ${{ github.workspace }} + with: + github_token: ${{ env.GITHUB_TOKEN }} + publish_dir: ${{ env.GITHUB_WORKSPACE }}/../public diff --git a/.github/actions/release_milestone/action.yaml b/.github/actions/release_milestone/action.yaml index 48d2ccbc8c..d2d165d80a 100644 --- a/.github/actions/release_milestone/action.yaml +++ b/.github/actions/release_milestone/action.yaml @@ -15,34 +15,84 @@ runs: with: node-version: '16' + - name: Setup git + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.github_token }} + run: | + git config user.name "GitHub Actions Bot" + git config user.email "<>" + + - name: Get current date + id: date + uses: Kaven-Universe/github-action-current-date-time@v1 + with: + format: 'YYYY-MM-DD' + + - name: Get current main version number + id: mainvers + uses: ashley-taylor/regex-property-action@v1 + env: + MILESTONE: ${{ inputs.milestone }} + with: + value: ${{ env.MILESTONE }} + regex: (\d+\.\d+)\.\d+ + replacement: "$1.0" + + - name: Get next version number + id: nextvers + uses: WyriHaximus/github-action-next-semvers@v1 + env: + MILESTONE: ${{ inputs.milestone }} + with: + version: ${{ env.MILESTONE }} + - name: Close milestone uses: Akkjon/close-milestone@v2 - with: - milestone_name: ${{ env.MILESTONE }} env: MILESTONE: ${{ inputs.milestone }} GITHUB_TOKEN: ${{ inputs.github_token }} + with: + milestone_name: ${{ env.MILESTONE }} - - name: Create provisionary tag + - name: Create temporary tag shell: bash env: MILESTONE: ${{ inputs.milestone }} GITHUB_TOKEN: ${{ inputs.github_token }} run: | - git config user.name "GitHub Actions Bot" - git config user.email "<>" git tag --message "" "$MILESTONE" git push origin "$MILESTONE" + - name: Update migration docs + uses: mingjun97/file-regex-replace@v1 + with: + regex: '(.)[\n\r\s]*[\n\r\s]*-*\s*[\n\r\s]*?[\n\r]+##\s*.*?[\n\r][\n\r\s]*(.)' + replacement: "$1\n\n\n\n---\n\n## ${{ steps.mainvers.outputs.value }} (${{ steps.date.outputs.time }})\n\n$2" + include: exampleSite/content/basics/migration/_index.en.md + + - name: Update generator version + shell: bash + env: + MILESTONE: ${{ inputs.milestone }} + run: | + echo -n "$MILESTONE" > layouts/partials/version.txt + - name: Update changelog + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.github_token }} + GREN_GITHUB_TOKEN: ${{ inputs.github_token }} + run: | + npx github-release-notes@0.17.1 changelog --generate --override --tags=all + + - name: Commit updates shell: bash env: MILESTONE: ${{ inputs.milestone }} GITHUB_TOKEN: ${{ inputs.github_token }} GREN_GITHUB_TOKEN: ${{ inputs.github_token }} run: | - echo -n "$MILESTONE" > layouts/partials/version.txt - npx github-release-notes@0.17.1 changelog --generate --override --tags=all git add * git commit --message "Ship tag $MILESTONE" git push origin main @@ -69,26 +119,16 @@ runs: env: MILESTONE: ${{ inputs.milestone }} GITHUB_TOKEN: ${{ inputs.github_token }} - GREN_GITHUB_TOKEN: ${{ inputs.github_token }} run: | echo -n "$MILESTONE+tip" > layouts/partials/version.txt git add * git commit --message "Mark non-release version" git push origin main - - name: Generate next version number - id: semvers - uses: WyriHaximus/github-action-next-semvers@v1 - with: - version: ${{ env.MILESTONE }} - env: - MILESTONE: ${{ inputs.milestone }} - GITHUB_TOKEN: ${{ inputs.github_token }} - - name: Create next patch milestone uses: WyriHaximus/github-action-create-milestone@v1 - with: - title: ${{ steps.semvers.outputs.patch }} env: MILESTONE: ${{ inputs.milestone }} GITHUB_TOKEN: ${{ inputs.github_token }} + with: + title: ${{ steps.nextvers.outputs.patch }} diff --git a/.github/workflows/deploy.yaml b/.github/workflows/docs-build-deployment.yaml similarity index 96% rename from .github/workflows/deploy.yaml rename to .github/workflows/docs-build-deployment.yaml index 942363d8ac..81a1e697cb 100644 --- a/.github/workflows/deploy.yaml +++ b/.github/workflows/docs-build-deployment.yaml @@ -1,4 +1,4 @@ -name: Deploy +name: docs-build-deployment on: push: # Build on all pushes but only deploy for main branch diff --git a/.github/workflows/build.yaml b/.github/workflows/docs-build.yaml similarity index 97% rename from .github/workflows/build.yaml rename to .github/workflows/docs-build.yaml index 178c52d44a..175b4f8f9e 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/docs-build.yaml @@ -1,4 +1,4 @@ -name: Build +name: docs-build on: push: # Build on all pushes but only deploy for main branch diff --git a/.github/workflows/release.yaml b/.github/workflows/version-release.yaml similarity index 98% rename from .github/workflows/release.yaml rename to .github/workflows/version-release.yaml index a7d7b6a8fb..bf76f2c756 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/version-release.yaml @@ -1,4 +1,4 @@ -name: Release +name: version-release on: workflow_dispatch: diff --git a/exampleSite/content/basics/migration/_index.en.md b/exampleSite/content/basics/migration/_index.en.md index be91d3b58b..6a9db29848 100644 --- a/exampleSite/content/basics/migration/_index.en.md +++ b/exampleSite/content/basics/migration/_index.en.md @@ -14,6 +14,8 @@ This document shows you what's new in the latest release. For a detailed list of {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Marks new behavior you might find interesting or comes configurable. + + --- ## 5.10.0 (2023-01-25) @@ -245,8 +247,6 @@ This document shows you what's new in the latest release. For a detailed list of The option is still useful in case you are using scripting to set up your graph. In this case no shortcode or codefence is involved and the library is not loaded by default. In this case you can set `disableMermaid=false` in your frontmatter to force the library to be loaded. See the [theme variant generator]({{%relref "basics/generator" %}}) of the exampleSite for an example. - **This change requires at least Hugo 0.93.0 to be used**. The minimum requirement will be reported during build on the console if not met. - - {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} Additional color variant variable `--MERMAID-theme` to set the variant's Mermaid theme. This causes the Mermaid theme to switch with the color variant if it defers from the setting of the formerly selected color variant. --- diff --git a/exampleSite/content/more/credits/_index.en.md b/exampleSite/content/more/credits/_index.en.md index b2dedee7a1..e652704c70 100644 --- a/exampleSite/content/more/credits/_index.en.md +++ b/exampleSite/content/more/credits/_index.en.md @@ -30,5 +30,18 @@ Many thanks to [Andy Miller](https://github.com/rhukster) for initially creating ## Tooling - [GitHub](https://github.com) - Continuous deployment, testing and hosting of this project's sources and its documentation +- Various GitHub Actions + - https://github.com/actions/setup-node + - https://github.com/Akkjon/close-milestone + - https://github.com/andstor/file-reader-action + - https://github.com/ashley-taylor/regex-property-action + - https://github.com/Kaven-Universe/github-action-current-date-time + - https://github.com/mingjun97/file-regex-replace + - https://github.com/mukunku/tag-exists-action + - https://github.com/octokit/graphql-action + - https://github.com/peaceiris/actions-gh-pages + - https://github.com/peaceiris/actions-hugo + - https://github.com/WyriHaximus/github-action-create-milestone + - https://github.com/WyriHaximus/github-action-next-semvers - [gren](https://github.com/github-tools/github-release-notes) - A releasenotes generator for GitHub - [Hugo](https://gohugo.io/) - The static site generator of your choice