chore(deps): update all non-major dependencies #27
This file contains 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 | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- 'packages/**/package.json' | |
jobs: | |
npm-publish: | |
name: Publish on NPM registry using `codemeistre-bot` user | |
runs-on: ubuntu-latest | |
if: "startsWith(github.event.head_commit.message, 'chore(release): ')" | |
env: | |
PACKAGES_PATH: 'packages' | |
HUSKY: 0 | |
CI: true | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@master | |
with: | |
fetch-depth: 0 | |
- id: manifest | |
run: echo "::set-output name=path::$( git diff-tree --relative="${PACKAGES_PATH}/" --no-commit-id --name-only -r ${{ github.sha }} | grep -m1 -E '/package.json$' )" | |
- name: Use node16 | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 16 | |
registry-url: https://registry.npmjs.org/ | |
cache: 'yarn' | |
- name: "Publish only if package's name has '@codemeistre' scope" | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
run: | | |
cd "./${PACKAGES_PATH}/$(dirname "${{ steps.manifest.outputs.path }}")" | |
pwd | |
package_name=$( jq --raw-output '"\(.name)"' package.json ) | |
[[ "$package_name" =~ ^@codemeistre/ ]] || exit 1 | |
yarn install --frozen-lock-file | |
yarn build | |
echo "@codemeistre:registry=https://registry.npmjs.org/" > ~/.npmrc | |
echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_AUTH_TOKEN }}" >> ~/.npmrc | |
npm publish --access public |