-
Notifications
You must be signed in to change notification settings - Fork 2
77 lines (66 loc) · 2.36 KB
/
release.yml
File metadata and controls
77 lines (66 loc) · 2.36 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
name: Release
on:
push:
branches: [master]
jobs:
build:
runs-on: ubuntu-latest
steps:
# Checkout the repository
- name: Checkout repository
uses: actions/checkout@v4
# Setup Node.js environment
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "22.x"
# Install dependencies
- name: Install dependencies
run: npm install
# Fetch package details (name and version)
- name: Get package details
id: package
uses: codex-team/action-nodejs-package-info@v1.1
# Install npm-pack-all to create a package archive
- name: Install npm pack
run: npm install npm-pack
# Pack the package into a .tgz archive
- name: Pack the npm package
run: npm pack
# Publish the package to npm
- name: Publish to npm
id: publish_npm
uses: JS-DevTools/npm-publish@v3
with:
token: ${{ secrets.NPM_TOKEN }}
# access: public # Uncomment this line if you want to publish the package as public for first time
# Auto-tag the new version if a change is detected
- name: Auto-tag new version
id: update_tag
uses: Klemensas/action-autotag@stable
with:
GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
tag_prefix: "v"
# Create a new GitHub Release
- name: Create GitHub Release
if: steps.update_tag.outputs.tagname != ''
uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.update_tag.outputs.tagname }}
release_name: Release ${{ steps.update_tag.outputs.tagname }}
draft: false
prerelease: false
# Upload the packaged .tgz file as a release asset
- name: Upload Release Asset
if: steps.update_tag.outputs.tagname != ''
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: "./contentstack-datasync-mongodb-sdk-${{ steps.package.outputs.version }}.tgz"
asset_name: "contentstack-datasync-mongodb-sdk-${{ steps.package.outputs.version }}.tgz"
asset_content_type: application/tgz