Skip to content

dx | 2326 npm publish #56

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 4 commits into from
Mar 26, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
67 changes: 47 additions & 20 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,43 +8,70 @@ jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
# 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"
- run: npm install

- name: get-package-details
# Install dependencies
- name: Install dependencies
run: npm install

# Fetch package details (name and version)
- name: Get package details
id: package
uses: codex-team/[email protected]
- name: install npm packall

# Install npm-pack-all to create a package archive
- name: Install npm-pack-all
run: npm install npm-pack-all

- run: node node_modules/.bin/npm-pack-all
- uses: Klemensas/action-autotag@stable
# Pack the package into a .tgz archive
- name: Pack the npm package
run: node node_modules/.bin/npm-pack-all

# 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"
- name: Create Release
if: steps.update_tag.outputs.tagname
uses: actions/create-release@v4

# 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 }} # This token is provided by Actions, you do not need to create your own token
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.update_tag.outputs.tagname }}
release_name: Release ${{ steps.update_tag.outputs.tagname }}
draft: false # Default value, but nice to set explicitly
prerelease: false # Default value, but nice to set explicitly
draft: false
prerelease: false

# Upload the packaged .tgz file as a release asset
- name: Upload Release Asset
if: steps.update_tag.outputs.tagname
id: upload-release-asset
uses: actions/upload-release-asset@v4
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 }} # 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
asset_path: ./${{ steps.package.outputs.name }}-${{ steps.package.outputs.version }}.tgz
asset_name: ${{ steps.package.outputs.name }}-${{ steps.package.outputs.version }}.tgz
asset_content_type: application/tgz
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
8 changes: 4 additions & 4 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"author": "Contentstack Ecosystem <[email protected]>",
"name": "datasync-mongodb-sdk",
"version": "1.0.9",
"name": "@contentstack/datasync-mongodb-sdk",
"version": "1.0.10",
"description": "Mongodb query wrapper around contents synced via @contentstack/content-store-mongodb",
"main": "dist/index.js",
"scripts": {
Expand Down
Loading