Merge pull request #72 from mondaycom/feature/romka/remove-bugged #89
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 Package to NPM | |
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| publish-npm: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - uses: actions/setup-node@v3 | |
| with: | |
| node-version: 18.18.1 | |
| registry-url: https://registry.npmjs.org/ | |
| - name: Install Yarn | |
| run: npm install -g [email protected] | |
| - run: yarn install | |
| # Build packages using Turborepo | |
| - name: Build packages | |
| run: yarn build | |
| - name: Get changed packages | |
| id: changed | |
| run: | | |
| CHANGED=$(git diff --name-only HEAD^ HEAD | grep "^packages/" | cut -d/ -f2 | sort -u | jq -R -s -c 'split("\n")[:-1]') | |
| echo "packages=$CHANGED" >> $GITHUB_OUTPUT | |
| - name: Configure Git | |
| run: | | |
| git config --global user.email "[email protected]" | |
| git config --global user.name "GitHub Actions" | |
| - name: Publish changed packages | |
| if: steps.changed.outputs.packages != '[]' | |
| run: | | |
| PACKAGES=$(echo '${{ steps.changed.outputs.packages }}' | jq -r '.[]') | |
| for PKG in $PACKAGES; do | |
| cd packages/$PKG | |
| yarn publish --access public | |
| cd ../.. | |
| done | |
| env: | |
| NODE_AUTH_TOKEN: ${{secrets.NPM_TOKEN}} |