chore: changes to yarn (#305) #42
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
| on: | |
| push: | |
| branches: | |
| - develop | |
| name: Publish to NPM | |
| jobs: | |
| publish: | |
| name: Publish | |
| runs-on: ubuntu-latest | |
| environment: dev | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Enable Corepack | |
| run: corepack enable | |
| - name: Use Node.js 18 | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: '18.x' | |
| always-auth: true | |
| - name: Bump version | |
| id: version | |
| run: | | |
| CURRENT_VERSION=$(jq -r '.version' package.json) | |
| BASE_VERSION=$(echo $CURRENT_VERSION | cut -d '-' -f 1) | |
| NEW_BASE=$(echo $BASE_VERSION | awk -v OFS='.' -F. '{ | |
| $2 = $2 + 1; | |
| $3 = 0; | |
| print $0 | |
| }') | |
| TIMESTAMP=$(date -u +"%Y%m%d%H%M%S") | |
| COMMIT_SHA=$(git rev-parse --short HEAD) | |
| NEW_VERSION="${NEW_BASE}-dev.${TIMESTAMP}.${COMMIT_SHA}" | |
| echo "new_version=$NEW_VERSION" >> $GITHUB_OUTPUT | |
| - name: Update package.json version | |
| run: | | |
| jq ".version = \"${{ steps.version.outputs.new_version }}\"" package.json > package.tmp | |
| mv package.tmp package.json | |
| - name: Install dependencies | |
| run: yarn install | |
| - name: Build | |
| run: yarn run build | |
| - name: Setup .yarnrc.yml | |
| run: | | |
| yarn config set npmAuthToken $NPM_AUTH_TOKEN | |
| yarn config set npmAlwaysAuth true | |
| env: | |
| NPM_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }} | |
| - name: Publish | |
| run: yarn npm publish --access public --tag dev |