diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be0d945..c2a6543 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -14,20 +14,54 @@ jobs: node-version: "18.x" - run: npm install - - name: get-npm-version - id: package-version - uses: martinbeentjes/npm-get-version-action@v1.3.1 - name: install npm packall run: npm install npm-pack-all - run: node node_modules/.bin/npm-pack-all - - uses: Klemensas/action-autotag@stable - id: update_tag +# The below action will see the existing tags and will bump the current ones and this is only used to check whether the given tag already exists or not +# We will be using the previous tag to compare with the current tag in the package.json +# If both match then no new release would be triggered +# Else New release will be created + - name: Bump version and push tag + id: tag_version + uses: mathieudutour/github-tag-action@v6.1 with: - GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" - tag_prefix: "v" + github_token: ${{ secrets.GITHUB_TOKEN }} + default_bump: false +# Getting the version info from package.json + - name: get-npm-version + id: package-version + uses: martinbeentjes/npm-get-version-action@v1.3.1 +# Here we are checking whether this is the first release or not and then checking if it is release or not + - name: check-first-release + env: + First_Release: ${{steps.tag_version.outputs.previous_tag=='v0.0.0'}} + run: | + if ${First_Release} == true; then + echo "fr=true" >> $GITHUB_ENV + echo "flag set to true" + else + echo "fr=false" >> $GITHUB_ENV + echo "flag set to false" + fi + - name: check-release-version + if: ${{env.fr=='false'}} + env: + old_version: ${{steps.tag_version.outputs.previous_tag}} + new_version: v${{steps.package-version.outputs.current-version}} + run: | + echo ${old_version} + echo ${new_version} + echo ${{env.old_version==env.new_version}} + if ${{env.old_version!=env.new_version}}; then + echo "fr=true" >> $GITHUB_ENV + echo "flag set to true" + else + echo "fr=false" >> $GITHUB_ENV + echo "flag set to false" + fi - name: github-release - if: steps.update_tag.outputs.tagname + if: ${{env.fr=='true'}} id: github-release env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/package-lock.json b/package-lock.json index ab880b6..b8c74ba 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "@contentstack/cli-cm-regex-validate", - "version": "1.1.9", + "version": "1.1.10", "lockfileVersion": 3, "requires": true, "packages": { "": { "name": "@contentstack/cli-cm-regex-validate", - "version": "1.1.9", + "version": "1.1.10", "license": "MIT", "dependencies": { "@contentstack/cli-command": "^1.2.10", @@ -6159,9 +6159,9 @@ } }, "node_modules/get-func-name": { - "version": "2.0.0", - "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.0.tgz", - "integrity": "sha512-Hm0ixYtaSZ/V7C8FJrtZIuBBI+iSgL+1Aq82zSu8VQNB4S3Gk8e7Qs3VwBDJAhmRZcFqkl3tQu36g/Foh5I5ig==", + "version": "2.0.2", + "resolved": "https://registry.npmjs.org/get-func-name/-/get-func-name-2.0.2.tgz", + "integrity": "sha512-8vXOvuE167CtIc3OyItco7N/dpRtBbYOsPsXCz7X/PMnlGjYjSGuZJgM1Y7mmew7BKf9BqvLX2tnOVy1BBUsxQ==", "dev": true, "engines": { "node": "*" diff --git a/package.json b/package.json index 836dbee..2e07881 100644 --- a/package.json +++ b/package.json @@ -1,7 +1,7 @@ { "name": "@contentstack/cli-cm-regex-validate", "description": "Validate Fields with Regex Property of Content Type and Global Field in a Stack", - "version": "1.1.9", + "version": "1.1.10", "author": "Contentstack", "bugs": "https://github.com/contentstack/cli-cm-regex-validate/issues", "devDependencies": {