Skip to content

Commit ed5ed2b

Browse files
authored
Merge pull request #54 from contentstack/bugfix/CS-41630
bugfix/CS-41630-Modified release workflow to remove the warnings, and npm audit fix, version bump
2 parents 88a478f + b8c7a86 commit ed5ed2b

File tree

3 files changed

+48
-14
lines changed

3 files changed

+48
-14
lines changed

.github/workflows/release.yml

Lines changed: 42 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -14,20 +14,54 @@ jobs:
1414
node-version: "18.x"
1515
- run: npm install
1616

17-
- name: get-npm-version
18-
id: package-version
19-
uses: martinbeentjes/[email protected]
2017
- name: install npm packall
2118
run: npm install npm-pack-all
2219

2320
- run: node node_modules/.bin/npm-pack-all
24-
- uses: Klemensas/action-autotag@stable
25-
id: update_tag
21+
# 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
22+
# We will be using the previous tag to compare with the current tag in the package.json
23+
# If both match then no new release would be triggered
24+
# Else New release will be created
25+
- name: Bump version and push tag
26+
id: tag_version
27+
uses: mathieudutour/[email protected]
2628
with:
27-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
28-
tag_prefix: "v"
29+
github_token: ${{ secrets.GITHUB_TOKEN }}
30+
default_bump: false
31+
# Getting the version info from package.json
32+
- name: get-npm-version
33+
id: package-version
34+
uses: martinbeentjes/[email protected]
35+
# Here we are checking whether this is the first release or not and then checking if it is release or not
36+
- name: check-first-release
37+
env:
38+
First_Release: ${{steps.tag_version.outputs.previous_tag=='v0.0.0'}}
39+
run: |
40+
if ${First_Release} == true; then
41+
echo "fr=true" >> $GITHUB_ENV
42+
echo "flag set to true"
43+
else
44+
echo "fr=false" >> $GITHUB_ENV
45+
echo "flag set to false"
46+
fi
47+
- name: check-release-version
48+
if: ${{env.fr=='false'}}
49+
env:
50+
old_version: ${{steps.tag_version.outputs.previous_tag}}
51+
new_version: v${{steps.package-version.outputs.current-version}}
52+
run: |
53+
echo ${old_version}
54+
echo ${new_version}
55+
echo ${{env.old_version==env.new_version}}
56+
if ${{env.old_version!=env.new_version}}; then
57+
echo "fr=true" >> $GITHUB_ENV
58+
echo "flag set to true"
59+
else
60+
echo "fr=false" >> $GITHUB_ENV
61+
echo "flag set to false"
62+
fi
2963
- name: github-release
30-
if: steps.update_tag.outputs.tagname
64+
if: ${{env.fr=='true'}}
3165
id: github-release
3266
env:
3367
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

package-lock.json

Lines changed: 5 additions & 5 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
22
"name": "@contentstack/cli-cm-regex-validate",
33
"description": "Validate Fields with Regex Property of Content Type and Global Field in a Stack",
4-
"version": "1.1.9",
4+
"version": "1.1.10",
55
"author": "Contentstack",
66
"bugs": "https://github.com/contentstack/cli-cm-regex-validate/issues",
77
"devDependencies": {

0 commit comments

Comments
 (0)