v0.2.4 #16
Workflow file for this run
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(s) to NPM | |
on: | |
release: | |
types: [created] | |
workflow_dispatch: {} | |
jobs: | |
npm-publish: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository | |
uses: actions/checkout@v2 | |
- name: Install modules | |
run: yarn install --immutable | |
- name: Build | |
run: yarn build | |
- name: Publish if version has been updated | |
run: | | |
for pkg in packages/*; do | |
name=$(basename "$pkg") | |
version=$(node -e "console.log(JSON.parse(require('fs').readFileSync('$pkg/package.json')).version)") | |
if [ $(npm view "$name" version) != "$version" ]; then | |
echo "Publishing package $name @ $version." | |
cp README.md "$pkg" | |
yarn workspace "$name" npm publish | |
fi | |
done | |
env: | |
YARN_NPM_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} |