Repository navigation
Mark latest #51
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: Build and Publish | |
| on: | |
| push: | |
| branches: | |
| - master | |
| pull_request: | |
| branches: | |
| - master | |
| types: [opened, synchronize, reopened, edited] | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: '20.12.2' | |
| registry-url: 'https://registry.npmjs.org' | |
| token: ${{ secrets.NPM_TOKEN }} | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build the project | |
| run: npm run build | |
| - name: Mark beta as latest | |
| run: npm dist-tag add hosted-fields-sdk@1.3.1 latest | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish to npm | |
| if: github.event_name == 'push' && github.ref == 'refs/heads/master' | |
| run: npm publish | |
| env: | |
| NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |