Skip to content

Commit fc3a312

Browse files
Merge pull request #92 from ganeshlt/master
GitHub Action for NPM Publishing upon tag release.
2 parents feae108 + 27d7043 commit fc3a312

File tree

1 file changed

+58
-0
lines changed

1 file changed

+58
-0
lines changed

.github/workflows/npm-publish.yml

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
# This workflow will run tests using node and then publish a package to GitHub Packages when a release is created
2+
# For more information see: https://help.github.com/actions/language-and-framework-guides/publishing-nodejs-packages
3+
4+
name: Cypress CLI Build and Publishing to NPM
5+
6+
on:
7+
release:
8+
types: [created]
9+
10+
jobs:
11+
build:
12+
runs-on: ubuntu-latest
13+
if: github.repository_owner == 'lambdatest'
14+
steps:
15+
- uses: actions/checkout@v2
16+
- uses: actions/setup-node@v2
17+
with:
18+
node-version: 16
19+
- run: npm ci
20+
21+
publish-npm:
22+
needs: build
23+
runs-on: ubuntu-latest
24+
steps:
25+
- uses: actions/checkout@v2
26+
- uses: actions/setup-node@v2
27+
with:
28+
node-version: 16
29+
registry-url: https://registry.npmjs.org/
30+
- name: PUBLISHING Cypress CLI Version ${{ github.event.release.tag_name }}
31+
run: |
32+
npm ci
33+
npm publish --access public
34+
echo "CHECKING on NPM REPO, whether new version starts reflecting there or not:";
35+
npm view lambdatest-cypress-cli versions --json
36+
env:
37+
NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}}
38+
- name: Send custom JSON data to Slack workflow
39+
id: slack
40+
uses: slackapi/slack-github-action@v1.17.0
41+
with:
42+
# For posting a rich message using Block Kit
43+
payload: |
44+
{
45+
"text": "GitHub Action build result for Cypress-CLI: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}",
46+
"blocks": [
47+
{
48+
"type": "section",
49+
"text": {
50+
"type": "mrkdwn",
51+
"text": "GitHub Action build result: ${{ job.status }}\n${{ github.event.pull_request.html_url || github.event.head_commit.url }}"
52+
}
53+
}
54+
]
55+
}
56+
env:
57+
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
58+
SLACK_WEBHOOK_TYPE: INCOMING_WEBHOOK

0 commit comments

Comments
 (0)