From 65f94bdcb30ab413a4dface163c85ec9f76f0a66 Mon Sep 17 00:00:00 2001 From: Zexi Yin Date: Sat, 29 Jun 2024 11:26:34 -0700 Subject: [PATCH] fixed: added regex validation for version name formatting --- .github/workflows/deploy-main-channel-to-dev.yaml | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/.github/workflows/deploy-main-channel-to-dev.yaml b/.github/workflows/deploy-main-channel-to-dev.yaml index 7801b2f3..a7913c4a 100644 --- a/.github/workflows/deploy-main-channel-to-dev.yaml +++ b/.github/workflows/deploy-main-channel-to-dev.yaml @@ -16,6 +16,12 @@ jobs: if: | !contains(github.event.head_commit.message, 'skip-ci') steps: + - name: Validate git-tag input format + run: | + if [[ ! "${{ github.event.inputs.git-tag }}" =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + echo "Error: Invalid git-tag format. Please use the format 'X.Y.Z' (e.g., '2.9.3')." >&2 + exit 1 + fi - uses: actions/checkout@v2 with: ref: main @@ -44,16 +50,13 @@ jobs: NODE_ENV: production - name: Set up QEMU uses: docker/setup-qemu-action@v1 - - name: Set up Docker Buildx uses: docker/setup-buildx-action@v1 - - name: Login to DockerHub uses: docker/login-action@v1 with: username: ${{ secrets.DOCKERHUB_USERNAME }} password: ${{ secrets.DOCKERHUB_TOKEN }} - - name: Build snapshot and push on merge id: docker_build_release uses: docker/build-push-action@v2 @@ -62,7 +65,6 @@ jobs: file: ./Dockerfile-dev push: true tags: greenstand/${{ github.event.repository.name }}-dev:${{ steps.package-version.outputs.current-version }} - - id: export_bumped_version run: | export BUMPED_VERSION="${{ steps.package-version.outputs.current-version }}"