Merge pull request #12 from restackio/dependabot/npm_and_yarn/example… #18
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: Publish "get-started" to npm | |
| on: | |
| push: | |
| branches: | |
| - 'main' | |
| paths: | |
| - 'examples/get-started/**' | |
| jobs: | |
| check_version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version_changed: ${{ steps.check_version.outputs.changed }} | |
| steps: | |
| - uses: actions/checkout@v2 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check if version has changed | |
| id: check_version | |
| run: | | |
| git diff HEAD^ HEAD -- examples/get-started/package.json | grep '"version"' && echo "changed=true" >> $GITHUB_OUTPUT || echo "changed=false" >> $GITHUB_OUTPUT | |
| publish: | |
| needs: check_version | |
| if: needs.check_version.outputs.version_changed == 'true' | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v2 | |
| - uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - uses: actions/setup-node@v2 | |
| with: | |
| node-version: 20 | |
| registry-url: 'https://registry.npmjs.org' | |
| # Only install dev dependencies, for the binary. No need to install deps for the source code. | |
| - name: Install dependencies | |
| run: pnpm install --dev | |
| working-directory: ./examples/get-started | |
| - name: Build binary | |
| run: pnpm run build-bin | |
| working-directory: ./examples/get-started | |
| - name: Publish to npm | |
| run: pnpm publish --access public --no-git-checks | |
| working-directory: ./examples/get-started | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |