From 7576b14a93a9f9d8f50ef4ce43bfd1a0949399ef Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Wed, 20 Dec 2023 00:14:56 +0100 Subject: [PATCH 1/3] fix editorconfig for yml files --- .editorconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.editorconfig b/.editorconfig index 21e257ee9..1c436d1ea 100644 --- a/.editorconfig +++ b/.editorconfig @@ -15,5 +15,5 @@ indent_size = 4 [*.md] trim_trailing_whitespace = false -[*.{js,yaml}] +[*.{js,yaml,yml}] indent_size = 2 From e5c3529217ec4550b213ef6909c52852e9b8254f Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Wed, 20 Dec 2023 00:30:07 +0100 Subject: [PATCH 2/3] set next develop version --- settings/version-number | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/settings/version-number b/settings/version-number index 6b4950e3d..71d37081c 100644 --- a/settings/version-number +++ b/settings/version-number @@ -1 +1 @@ -2.4 +2.5.0-alpha From d860c37be3d0bd9967d1590d1ab87453c7d98a4a Mon Sep 17 00:00:00 2001 From: Alvin Schiller <103769832+AlvinSchiller@users.noreply.github.com> Date: Wed, 20 Dec 2023 00:30:43 +0100 Subject: [PATCH 3/3] add workflow for releases --- .github/workflows/release.yml | 97 +++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 000000000..afa3347f8 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,97 @@ +name: Release + +on: + push: + branches: + - 'main' + +jobs: + + check: + # TODO remove test code + if: ${{ github.repository_owner == 'MiczFlor' || github.repository_owner == 'AlvinSchiller' }} + runs-on: ubuntu-latest + + outputs: + tag_name: ${{ steps.vars.outputs.tag_name }} + release_type: ${{ steps.vars.outputs.release_type }} + check_abort: ${{ steps.vars.outputs.check_abort }} + + steps: + - uses: actions/checkout@v3 + + - name: Set Output vars + id: vars + env: + BRANCH_NAME: ${{ github.ref_name }} + run: | + # Official SemVer Regex definition + # https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string + # Needed changes to the regex: + # - '?:' capture command needed to be removed as it wasn't working in shell + # - '\d' had to be replaced with [0-9] + # + # Release versions like 1.0.0, 3.5.0, 100.4.50000+metadata + REGEX_VERSION_RELEASE="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$" + # + # Prerelease versions like 1.0.0-alpha, 3.5.0-whatsoever.12, 100.4.50000-identifier.12+metadata + REGEX_VERSION_PRERELEASE="^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)(-((0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*)(\.(0|[1-9][0-9]*|[0-9]*[a-zA-Z-][0-9a-zA-Z-]*))*))?(\+([0-9a-zA-Z-]+(\.[0-9a-zA-Z-]+)*))?$" + + + # Get the version and calculate release type + VERSION=$(cat ./settings/version-number) + if echo "$VERSION" | grep -qoE "$REGEX_VERSION_RELEASE" ; then + RELEASE_TYPE=release + elif echo "$VERSION" | grep -qoE "$REGEX_VERSION_PRERELEASE" ; then + RELEASE_TYPE=prerelease + else + RELEASE_TYPE=none + fi + + if [ "$BRANCH_NAME" == 'main' -a "$RELEASE_TYPE" == 'release' ] ; then + CHECK_ABORT=false + else + echo "::notice title=Abort due to not matching ${RELEASE_TYPE} version for branch!::'${VERSION}' on '${BRANCH_NAME}'" + CHECK_ABORT=true + fi + + echo "::group::Output values" + echo "Version: ${VERSION}" + echo "RELEASE_TYPE: ${RELEASE_TYPE}" + echo "BRANCH_NAME: ${BRANCH_NAME}" + echo "CHECK_ABORT: ${CHECK_ABORT}" + + echo "tag_name=v${VERSION}" >> $GITHUB_OUTPUT + echo "release_type=${RELEASE_TYPE}" >> $GITHUB_OUTPUT + echo "branch_name=${BRANCH_NAME}" >> $GITHUB_OUTPUT + echo "check_abort=${CHECK_ABORT}" >> $GITHUB_OUTPUT + echo "::endgroup::" + + release: + needs: [check] + if: ${{ needs.check.outputs.check_abort == 'false' }} + runs-on: ubuntu-latest + + concurrency: + group: ${{ needs.check.outputs.tag_name }} + + permissions: + contents: write + + steps: + - name: Create Release + uses: ncipollo/release-action@v1 + with: + commit: ${{ github.sha }} + tag: ${{ needs.check.outputs.tag_name }} + body: "Automated Release for ${{ needs.check.outputs.tag_name }}" + makeLatest: ${{ needs.check.outputs.release_type == 'release' }} + prerelease: ${{ needs.check.outputs.release_type == 'prerelease' }} + generateReleaseNotes: ${{ needs.check.outputs.release_type == 'release' }} + skipIfReleaseExists: false + allowUpdates: true + removeArtifacts: false + replacesArtifacts: false + omitBodyDuringUpdate: true + omitNameDuringUpdate: true + token: ${{ secrets.GITHUB_TOKEN }}