Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

git now checks out head rather than some magical commit #81

Merged
merged 1 commit into from
Mar 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
AnomalRoil marked this conversation as resolved.
Show resolved Hide resolved

- 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
Loading