Develop #474
Workflow file for this run
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 | |
| on: | |
| push: | |
| branches: | |
| - master | |
| - develop | |
| pull_request: | |
| branches: | |
| - master | |
| - develop | |
| jobs: | |
| publish: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v4 | |
| with: | |
| node-version: 18 | |
| cache: "yarn" | |
| - name: Install | |
| run: yarn install --frozen-lockfile | |
| - name: Build | |
| run: yarn build:prod | |
| - name: Test | |
| run: yarn test --detectOpenHandles --forceExit | |
| - name: Setup Custom Contexts | |
| shell: bash | |
| run: | | |
| echo "branch=$(echo ${GITHUB_REF##*/})" >> $GITHUB_OUTPUT | |
| echo "version=$(cat ./package.json | grep version | head -1 | awk -F: '{ print $2 }' | sed 's/[",]//g' | tr -d '[[:space:]]')" >> $GITHUB_OUTPUT | |
| echo "short_sha=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT | |
| id: job_context | |
| - name: Make snapshot version | |
| if: steps.job_context.outputs.branch != 'master' | |
| run: | | |
| npm version prerelease --preid=${{ steps.job_context.outputs.short_sha }} --git-tag-version false | |
| working-directory: ${{env.working-directory}} | |
| - name: Publish package to latest | |
| if: steps.job_context.outputs.branch == 'master' | |
| working-directory: ${{env.working-directory}} | |
| run: | | |
| npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} | |
| npm publish --ignore-scripts --access public | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} | |
| - name: Publish package to branch-tag | |
| if: steps.job_context.outputs.branch != 'master' | |
| working-directory: ${{env.working-directory}} | |
| run: | | |
| npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN} | |
| npm publish --ignore-scripts --access public --tag $(echo "develop-${{ steps.job_context.outputs.version }}-rc" | sed 's/[.]//g') | |
| env: | |
| NPM_TOKEN: ${{ secrets.NPM_TOKEN }} |