Skip to content

Commit

Permalink
fix github action
Browse files Browse the repository at this point in the history
  • Loading branch information
KristampsWong committed Oct 2, 2023
1 parent 0360c60 commit 8a5a1a5
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 9 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/node-pretest.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4
- uses: actions/setup-node@v3
with:
with:
node-version: 'lts/*'
registry-url: "https://registry.npmjs.org"
- run: npm install
Expand Down
34 changes: 26 additions & 8 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -47,13 +47,31 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Check for changes in package
id: check_changes
run: |
git fetch
CHANGED=$(git diff --name-only ${{ github.event.before }} ${{ github.sha }} -- "packages/${{ matrix.package }}")
if [[ -z "$CHANGED" ]]; then
echo "No changes in ${{ matrix.package }} since last commit."
echo "::set-output name=changed::false"
else
echo "Changes detected in ${{ matrix.package }}."
echo "::set-output name=changed::true"
fi
continue-on-error: true

- uses: actions/setup-node@v3
with:
node-version: 'lts/*'
registry-url: "https://registry.npmjs.org"
- run: npm install
if: steps.check_changes.outputs.changed == 'true'
with:
node-version: 'lts/*'
registry-url: "https://registry.npmjs.org"
- run: npm install
if: steps.check_changes.outputs.changed == 'true'

- name: Publish to npm
if: steps.check_changes.outputs.changed == 'true'
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

- name: Publish to npm
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

0 comments on commit 8a5a1a5

Please sign in to comment.