diff --git a/.github/files/autorelease.sh b/.github/files/autorelease.sh index 694fe87f..276f6572 100755 --- a/.github/files/autorelease.sh +++ b/.github/files/autorelease.sh @@ -9,11 +9,17 @@ set -eo pipefail : "${GITHUB_REPOSITORY:?Build argument needs to be set and non-empty.}" ## Determine tag -if [[ ! "$GITHUB_REF" =~ ^refs/tags/v?[0-9]+(\.[0-9]+)+$ ]]; then +if [[ ! "$GITHUB_REF" =~ ^refs/tags/v?[0-9]+(\.[0-9]+)+(-[a-z0-9._-]+)?$ ]]; then echo "::error::Expected GITHUB_REF like \`refs/tags/v1.2.3\` or \`refs/tags/1.2.3\`, got \`$GITHUB_REF\`" exit 1 fi TAG="${GITHUB_REF#refs/tags/}" + +## Check for alphas +if [[ "$TAG" =~ -(alpha|a\.[0-9]*[02468])$ ]]; then + echo "Not creating a release for alpha version $TAG" + exit 0 +fi echo "Creating release for $TAG" ## Determine slug and title format. diff --git a/.github/workflows/autorelease.yml b/.github/workflows/autorelease.yml index 5368bdf4..7fb76b4f 100644 --- a/.github/workflows/autorelease.yml +++ b/.github/workflows/autorelease.yml @@ -4,8 +4,11 @@ on: push: tags: - 'v?[0-9]+.[0-9]+' + - 'v?[0-9]+.[0-9]+-*' - 'v?[0-9]+.[0-9]+.[0-9]+' + - 'v?[0-9]+.[0-9]+.[0-9]+-*' - 'v?[0-9]+.[0-9]+.[0-9]+.[0-9]+' + - 'v?[0-9]+.[0-9]+.[0-9]+.[0-9]+-*' jobs: publish: diff --git a/.github/workflows/autotagger.yml b/.github/workflows/autotagger.yml index a653d6e5..a28f1e66 100644 --- a/.github/workflows/autotagger.yml +++ b/.github/workflows/autotagger.yml @@ -63,7 +63,7 @@ jobs: VER=$(sed -nEe 's/^## \[?([^]]*)\]? - .*/\1/;T;p;q' CHANGELOG.md || true) echo "Version from changelog is ${VER:-}" echo "version=$VER" >> "$GITHUB_OUTPUT" - if [[ "$VER" =~ ^[0-9]+(\.[0-9]+)+$ ]]; then + if [[ "$VER" =~ ^[0-9]+(\.[0-9]+)+(-[a-z0-9._-]+)?$ && ! "$VER" =~ -(alpha|a\.[0-9]*[02468])$ ]]; then echo "Version $VER ok to tag" echo "run=true" >> "$GITHUB_OUTPUT" else @@ -77,7 +77,7 @@ jobs: run: | RUN=true if [[ -e composer.json ]]; then - TMP=$(jq -r '.require // {} | to_entries[] | select( .value | test( "-(alpha|a.[0-9]+)$" ) ) | "\(.key) (\(.value))"' composer.json) + TMP=$(jq -r '.require // {} | to_entries[] | select( .value | test( "-(alpha|a\\.[0-9]*[02468])$" ) ) | "\(.key) (\(.value))"' composer.json) if [[ -n "$TMP" ]]; then echo "::notice::Not tagging due to -alpha deps on ${TMP//$'\n'/ }" RUN=false