From c05388ccd145d12058d76898508dc9077ce09636 Mon Sep 17 00:00:00 2001 From: Mikkel Jakobsen Date: Mon, 11 Dec 2023 10:50:47 +0100 Subject: [PATCH] Sluggify branch/tag name Otherwise the zip step fails on branches/tags with "/" in it. --- .github/workflows/create-release-on-branch-changes.yml | 3 ++- .github/workflows/create-release-on-tag.yml | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/create-release-on-branch-changes.yml b/.github/workflows/create-release-on-branch-changes.yml index 7ff8a7bf50..b2201b0634 100644 --- a/.github/workflows/create-release-on-branch-changes.yml +++ b/.github/workflows/create-release-on-branch-changes.yml @@ -20,13 +20,14 @@ jobs: # development. run: | RELEASE_BRANCH=$(echo ${GITHUB_REF#refs/heads/}) + RELEASE_BRANCH_SLUGGED=$(echo $RELEASE_BRANCH | sed -E -e 's/[^[:alnum:]]+/-/g' -e 's/^-+|-+$//g' | tr '[:upper:]' '[:lower:]') RELEASE_SHA=${{ github.sha }} TAG_NAME=$(echo "branch-${RELEASE_BRANCH}") echo "RELEASE_BRANCH=$RELEASE_BRANCH" >> "$GITHUB_ENV" echo "RELEASE_SHA=$RELEASE_SHA" >> "$GITHUB_ENV" echo "TAG_NAME=$TAG_NAME" >> "$GITHUB_ENV" echo "BUILD_VERSION=${RELEASE_BRANCH}-${RELEASE_SHA}" >> "$GITHUB_ENV" - echo "DIST_FILENAME=dist-$RELEASE_BRANCH.zip" >> "$GITHUB_ENV" + echo "DIST_FILENAME=dist-${RELEASE_BRANCH_SLUGGED}.zip" >> "$GITHUB_ENV" # Checkout the HEAD of the PR branch to get the latest commit message. - uses: actions/checkout@v4 diff --git a/.github/workflows/create-release-on-tag.yml b/.github/workflows/create-release-on-tag.yml index 8031bf316d..1bc2c99279 100644 --- a/.github/workflows/create-release-on-tag.yml +++ b/.github/workflows/create-release-on-tag.yml @@ -14,11 +14,12 @@ jobs: id: resolve-release-vars run: | RELEASE_NAME=${{ github.ref_name }} + RELEASE_NAME_SLUGGED=$(echo $RELEASE_NAME | sed -E -e 's/[^[:alnum:]]+/-/g' -e 's/^-+|-+$//g' | tr '[:upper:]' '[:lower:]') RELEASE_SHA=${{ github.sha }} echo "RELEASE_NAME=$RELEASE_NAME" >> "$GITHUB_ENV" echo "RELEASE_SHA=$RELEASE_SHA" >> "$GITHUB_ENV" echo "BUILD_VERSION=${RELEASE_NAME}-${RELEASE_SHA}" >> "$GITHUB_ENV" - echo "DIST_FILENAME=dist-$RELEASE_NAME-$RELEASE_SHA.zip" >> "$GITHUB_ENV" + echo "DIST_FILENAME=dist-${RELEASE_NAME_SLUGGED}-${RELEASE_SHA}.zip" >> "$GITHUB_ENV" - uses: actions/checkout@v4 - name: Setup Node