add changeset version check #25
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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
- add-changeset-version-check | |
permissions: | |
pull-requests: write | |
contents: write | |
jobs: | |
lint_test: | |
uses: babylonlabs-io/.github/.github/workflows/reusable_node_lint_test.yml@add-changeset-version-check | |
secrets: inherit | |
with: | |
run-build: true | |
run-unit-tests: false | |
run-changesets: true | |
run-changesets-version-check: true | |
publish: ${{ github.event_name == 'workflow_dispatch' }} | |
check_version_change: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Check for version change | |
id: version_check | |
run: | | |
git fetch origin main | |
git diff origin/main -- package.json | grep '"version":' || echo "No version change detected" | |
- name: Conditional Release | |
if: steps.version_check.outputs.version_changed == 'true' | |
run: npm run release |