Skip to content

Commit 09fc572

Browse files
authored
Merge pull request #18 from contentstack/staging
Merge staging to master
2 parents 18e823c + 0f531ee commit 09fc572

File tree

3 files changed

+61
-36
lines changed

3 files changed

+61
-36
lines changed

.github/workflows/github-release.yml

Lines changed: 46 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: Release
1+
name: Release Webhook Listener
22

33
on:
44
push:
@@ -14,32 +14,57 @@ jobs:
1414
node-version: "18.x"
1515
- run: npm install
1616

17-
- name: get-package-details
18-
id: package
19-
uses: codex-team/[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+
22+
# 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
23+
# We will be using the previous tag to compare with the current tag in the package.json
24+
# If both match then no new release would be triggered
25+
# Else New release will be created
26+
- name: Bump version and push tag
27+
id: tag_version
28+
uses: mathieudutour/[email protected]
2629
with:
27-
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
28-
tag_prefix: "v"
30+
github_token: ${{ secrets.GITHUB_TOKEN }}
31+
default_bump: false
32+
# Getting the version info from package.json
33+
- name: get-npm-version
34+
id: package-version
35+
uses: martinbeentjes/[email protected]
36+
# Here we are checking whether this is the first release or not and then checking if it is release or not
37+
- name: check-first-release
38+
env:
39+
First_Release: ${{steps.tag_version.outputs.previous_tag=='v0.0.0'}}
40+
run: |
41+
if ${First_Release} == true; then
42+
echo "fr=true" >> $GITHUB_ENV
43+
echo "flag set to true"
44+
else
45+
echo "fr=false" >> $GITHUB_ENV
46+
echo "flag set to false"
47+
fi
48+
- name: check-release-version
49+
if: ${{env.fr=='false'}}
50+
env:
51+
old_version: ${{steps.tag_version.outputs.previous_tag}}
52+
new_version: v${{steps.package-version.outputs.current-version}}
53+
run: |
54+
echo ${old_version}
55+
echo ${new_version}
56+
echo ${{env.old_version==env.new_version}}
57+
if ${{env.old_version!=env.new_version}}; then
58+
echo "fr=true" >> $GITHUB_ENV
59+
echo "flag set to true"
60+
else
61+
echo "fr=false" >> $GITHUB_ENV
62+
echo "flag set to false"
63+
fi
2964
- name: Create Release
30-
if: steps.update_tag.outputs.tagname
3165
id: create_release
32-
env:
33-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # This token is provided by Actions, you do not need to create your own token
34-
run: gh release create v${{ steps.update_tag.outputs.version }} --title "Release ${{ steps.update_tag.outputs.version }}" --generate-notes
35-
- name: Upload Release Asset
36-
if: steps.update_tag.outputs.tagname
37-
id: upload-release-asset
38-
uses: actions/upload-release-asset@v1
66+
if: ${{env.fr=='true'}}
3967
env:
4068
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
41-
with:
42-
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing its ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
43-
asset_path: ./contentstack-webhook-listener-${{ steps.package.outputs.version }}.tgz
44-
asset_name: contentstack-webhook-listener-${{ steps.package.outputs.version }}.tgz
45-
asset_content_type: application/tgz
69+
run: gh release create v${{steps.package-version.outputs.current-version}} --title "Release ${{steps.package-version.outputs.current-version}}" --generate-notes ./contentstack-webhook-listener-${{ steps.package-version.outputs.current-version }}.tgz
70+

package-lock.json

Lines changed: 14 additions & 14 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,6 +1,6 @@
11
{
22
"name": "@contentstack/webhook-listener",
3-
"version": "1.0.4",
3+
"version": "1.0.5",
44
"description": "HTTP web server that listens to Contentstack webhooks. This is part of Contentstack DataSync",
55
"main": "./dist",
66
"types": "./typings",

0 commit comments

Comments
 (0)