diff --git a/.github/workflows/preview-image.yml b/.github/workflows/preview-image.yml index 9a691fb6f4..43b81ade9d 100644 --- a/.github/workflows/preview-image.yml +++ b/.github/workflows/preview-image.yml @@ -5,8 +5,6 @@ on: - Tests types: - completed - branches: - - master env: DOCKER_REPO: redash @@ -14,7 +12,7 @@ env: jobs: build-skip-check: runs-on: ubuntu-22.04 - if: ${{ github.event.workflow_run.conclusion == 'success' }} + if: ${{ github.event.workflow_run.conclusion == 'success' && (endsWith(github.event.workflow_run.head_branch, '-dev') || startsWith(github.event.workflow_run.head_branch, 'master')) }} outputs: skip: ${{ steps.skip-check.outputs.skip }} steps: @@ -71,7 +69,12 @@ jobs: run: | set -x VERSION=$(jq -r .version package.json) - FULL_VERSION=${VERSION}-b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER} + BRANCH=${{ event.workflow_run.head_branch }} + if [[ "$BRANCH" =~ ^[0-9]+\.[0-9]+\.[0-9]+\-dev ]]; then + FULL_VERSION=${VERSION} + else + FULL_VERSION=${VERSION}-b${GITHUB_RUN_ID}.${GITHUB_RUN_NUMBER} + fi sed -ri "s/^__version__ = ([A-Za-z0-9.-]*)'/__version__ = '${FULL_VERSION}'/" redash/__init__.py sed -i "s/dev/${GITHUB_SHA}/" client/app/version.json echo "VERSION_TAG=$FULL_VERSION" >> "$GITHUB_OUTPUT"