Merge pull request #77 from contentstack/development #26
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout repository | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "22.x" | |
- name: Install dependencies | |
run: npm install | |
- name: Get package details | |
id: package | |
uses: codex-team/[email protected] | |
- name: Install npm pack | |
run: npm install npm-pack | |
- name: Pack the npm package | |
run: npm pack | |
# Publish 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 new version | |
- name: Auto-tag new version | |
id: update_tag | |
uses: Klemensas/action-autotag@stable | |
with: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
tag_prefix: "v" | |
# Create 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 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-filesystem-sdk-${{ steps.package.outputs.version }}.tgz" | |
asset_name: "contentstack-datasync-filesystem-sdk-${{ steps.package.outputs.version }}.tgz" | |
asset_content_type: application/tgz |