Skip to content

Commit

Permalink
git now checks out head rather than some magical commit (#81)
Browse files Browse the repository at this point in the history
reorded the publish to npm as it checks the version anyway
  • Loading branch information
CluEleSsUK authored Mar 18, 2024
1 parent c79ad3f commit 97f2c8f
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
steps:
- uses: actions/checkout@v3
with:
ref: ${{ github.event.pull_request.head.sha }}
fetch-depth: 2

- uses: actions/setup-node@v3
Expand All @@ -36,24 +37,23 @@ jobs:
- name: Run the tests
run: npm test

- name: Check for version change
id: version-check
run: |
[ "$(git show head^:package.json | jq .version)" = "$(cat package.json | jq .version)" ] && echo "::set-output name=version_changed::true" || echo "::set-output name=version_changed::false"
- name: Copy relevant documentation into the build folder
if: steps.version-check.outputs.version_changed == 'true'
run: cp package.json README.md LICENSE-APACHE LICENSE-MIT ./build

- name: Publish to npmjs
uses: JS-DevTools/npm-publish@v1
if: github.ref == 'refs/heads/master' && steps.version-check.outputs.version_changed == 'true'
if: github.ref == 'refs/heads/master'
with:
token: ${{ secrets.NPM_TOKEN }}
package: build/package.json
# don't try and deploy if versions haven't changed
check-version: true

- name: Check for version change
id: version-check
run: |
[ "$(git show head^:package.json | jq .version)" = "$(cat package.json | jq .version)" ] && echo "::set-output name=version_changed::true" || echo "::set-output name=version_changed::false"
- name: Create tag variable
id: tagging
if: github.ref == 'refs/heads/master' && steps.version-check.outputs.version_changed == 'true'
Expand Down

0 comments on commit 97f2c8f

Please sign in to comment.