From 41e3d96a64887e32cd4810c89b8a15645a6b230f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?S=C3=B6ren=20Weber?= Date: Mon, 30 Jan 2023 12:57:11 +0100 Subject: [PATCH] build: add moving version tags #453 --- .github/actions/release_milestone/action.yaml | 33 ++++++++++++++++--- .../content/basics/migration/_index.en.md | 2 ++ .../content/dev/maintaining/_index.en.md | 2 +- 3 files changed, 31 insertions(+), 6 deletions(-) diff --git a/.github/actions/release_milestone/action.yaml b/.github/actions/release_milestone/action.yaml index d2d165d80a..5f132298fc 100644 --- a/.github/actions/release_milestone/action.yaml +++ b/.github/actions/release_milestone/action.yaml @@ -37,7 +37,17 @@ runs: with: value: ${{ env.MILESTONE }} regex: (\d+\.\d+)\.\d+ - replacement: "$1.0" + replacement: "$1" + + - name: Get current major version number + id: majorvers + uses: ashley-taylor/regex-property-action@v1 + env: + MILESTONE: ${{ inputs.milestone }} + with: + value: ${{ env.MILESTONE }} + regex: (\d+)\.\d+\.\d+ + replacement: "$1" - name: Get next version number id: nextvers @@ -61,14 +71,16 @@ runs: MILESTONE: ${{ inputs.milestone }} GITHUB_TOKEN: ${{ inputs.github_token }} run: | - git tag --message "" "$MILESTONE" - git push origin "$MILESTONE" + git tag --message "" "$MILESTONE" || true + git push origin "$MILESTONE" || true + git tag --force --message "" "$MILESTONE" + git push --force 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" + replacement: "$1\n\n\n\n---\n\n## ${{ steps.mainvers.outputs.value }}.0 (${{ steps.date.outputs.time }})\n\n$2" include: exampleSite/content/basics/migration/_index.en.md - name: Update generator version @@ -99,12 +111,23 @@ runs: - name: Create final tag shell: bash + continue-on-error: true env: MILESTONE: ${{ inputs.milestone }} + MILESTONE_MINOR: ${{ steps.mainvers.outputs.value }} + MILESTONE_MAJOR: ${{ steps.majorvers.outputs.value }} GITHUB_TOKEN: ${{ inputs.github_token }} run: | - git tag --force --message "" "$MILESTONE" + git tag --force --message "" "$MILESTONE" git push --force origin "$MILESTONE" + git tag --message "" "$MILESTONE_MINOR.x" || true + git push origin "$MILESTONE_MINOR.x" || true + git tag --force --message "" "$MILESTONE_MINOR.x" + git push --force origin "$MILESTONE_MINOR.x" + git tag --message "" "$MILESTONE_MAJOR.x" || true + git push origin "$MILESTONE_MAJOR.x" || true + git tag --force --message "" "$MILESTONE_MAJOR.x" + git push --force origin "$MILESTONE_MAJOR.x" - name: Publish release shell: bash diff --git a/exampleSite/content/basics/migration/_index.en.md b/exampleSite/content/basics/migration/_index.en.md index c0fdd7554e..9f321b2075 100644 --- a/exampleSite/content/basics/migration/_index.en.md +++ b/exampleSite/content/basics/migration/_index.en.md @@ -26,6 +26,8 @@ This document shows you what's new in the latest release. For a detailed list of As a further advantage, the image inside the lightbox now has its own URL and is therefore linkable. +- {{% badge style="info" icon="plus-circle" title=" " %}}New{{% /badge %}} [GitHub releases](https://github.com/McShelby/hugo-theme-relearn/tags) are also now tagged for the main version (eg. `1.2.x`) and major version (eg. `1.x`) making it easier for you to pin the theme to a certain version. + --- ## 5.10.0 (2023-01-25) diff --git a/exampleSite/content/dev/maintaining/_index.en.md b/exampleSite/content/dev/maintaining/_index.en.md index 693493440c..a4b8a7c6cb 100644 --- a/exampleSite/content/dev/maintaining/_index.en.md +++ b/exampleSite/content/dev/maintaining/_index.en.md @@ -115,7 +115,7 @@ After a successful run of the action - the version number for the `` is updated - the updated files are commited - the milestone is closed -- the repository is tagged with the version number +- the repository is tagged with the version number (eg. `1.2.3`), the main version number (eg. `1.2.x`) and the major version number (eg. `1.x`) - a new entry in the [GitHub release list](https://github.com/McShelby/hugo-theme-relearn/releases) with the according changelog will be created - the [official documentation](https://mcshelby.github.io/hugo-theme-relearn/index.html) is built and deployed - the version number for the `` is updated to a temporary and commited (this helps to determine if users are running directly on the main branch or are using releases)