Merge pull request #72 from Onboardbase/redaction #58
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: Deploy CLI to NPM | |
| on: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # This ensures we fetch all tags | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: "20" | |
| - run: yarn install | |
| - run: yarn build | |
| # Get the version from package.json | |
| - name: Get version | |
| id: package_version | |
| run: echo "VERSION=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT | |
| # Publish to npm | |
| - uses: JS-DevTools/npm-publish@v2 | |
| with: | |
| token: ${{ secrets.NPM_TOKEN }} | |
| # Create git tag based on package version | |
| - name: Create Git tag | |
| run: | | |
| git tag v${{ steps.package_version.outputs.VERSION }} | |
| git push origin v${{ steps.package_version.outputs.VERSION }} | |
| release: | |
| needs: publish | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 # This ensures we fetch all tags | |
| - name: Get latest tag | |
| id: latest_tag | |
| run: echo "TAG=$(git describe --tags --abbrev=0)" >> $GITHUB_OUTPUT | |
| - name: Create GitHub Release | |
| uses: actions/create-release@v1 | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| with: | |
| tag_name: ${{ steps.latest_tag.outputs.TAG }} | |
| release_name: Release ${{ steps.latest_tag.outputs.TAG }} | |
| body: | | |
| Release for version ${{ steps.latest_tag.outputs.TAG }} | |
| See the [changelog](./CHANGELOG.md) for details. | |
| draft: false | |
| prerelease: false |