Merge pull request #24 from sv2dev/fix/route-resolution-skip-unmatche… #9
This file contains hidden or 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: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| check-version: | |
| name: Check if version changed | |
| runs-on: ubuntu-latest | |
| outputs: | |
| core-changed: ${{ steps.check.outputs.core-changed }} | |
| lit-changed: ${{ steps.check.outputs.lit-changed }} | |
| steps: | |
| - uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 2 | |
| - name: Check if package.json version changed | |
| id: check | |
| shell: bash | |
| run: | | |
| function get_version() { | |
| local package_path=$1 | |
| if [ -f "$package_path" ]; then | |
| jq -r .version "$package_path" || echo "0.0.0" | |
| else | |
| echo "0.0.0" | |
| fi | |
| } | |
| CURRENT_CORE_VERSION=$(get_version "packages/esroute/package.json") | |
| CURRENT_LIT_VERSION=$(get_version "packages/esroute-lit/package.json") | |
| git checkout HEAD^ | |
| PREVIOUS_CORE_VERSION=$(get_version "packages/esroute/package.json") | |
| PREVIOUS_LIT_VERSION=$(get_version "packages/esroute-lit/package.json") | |
| core_changed=$([ "$CURRENT_CORE_VERSION" != "$PREVIOUS_CORE_VERSION" ] && echo "true" || echo "false") | |
| lit_changed=$([ "$CURRENT_LIT_VERSION" != "$PREVIOUS_LIT_VERSION" ] && echo "true" || echo "false") | |
| echo "core-changed=$core_changed" >> "$GITHUB_OUTPUT" | |
| echo "lit-changed=$lit_changed" >> "$GITHUB_OUTPUT" | |
| publish: | |
| name: Publish packages | |
| needs: check-version | |
| if: needs.check-version.outputs.core-changed == 'true' || needs.check-version.outputs.lit-changed == 'true' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: "https://registry.npmjs.org" | |
| - run: npm install | |
| - name: Publish core package | |
| if: needs.check-version.outputs.core-changed == 'true' | |
| run: | | |
| cd packages/esroute | |
| npm publish --provenance --access public | |
| - name: Publish lit package | |
| if: needs.check-version.outputs.lit-changed == 'true' | |
| run: | | |
| cd packages/esroute-lit | |
| npm publish --provenance --access public |