Add if to check version change status before publishing #3
Workflow file for this run
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: Release IPA Package | ||
| on: | ||
| workflow_dispatch: | ||
| push: | ||
| branches: | ||
| - main | ||
| paths: | ||
| - 'tools/spectral/ipa/package.json' | ||
| jobs: | ||
| check-version: | ||
| runs-on: ubuntu-latest | ||
| steps: | ||
| - name: Checkout Repository | ||
| uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | ||
| with: | ||
| fetch-depth: 0 | ||
| sparse-checkout: | | ||
| tools/spectral/ipa | ||
| .github/scripts | ||
| - name: Fetch Versions | ||
| id: version_check | ||
| run: | | ||
| chmod +x ./.github/scripts/ipa_version_check.sh | ||
| version_changed=$(./.github/scripts/ipa_version_check.sh) | ||
| echo "Version changed? ${version_changed}" | ||
| echo "version_changed=${version_changed}" >> "${GITHUB_ENV}" | ||
| - name: Check Version Bump | ||
| run: | | ||
| if [[ "${{ env.version_changed }}" == "false" ]]; then | ||
| echo "No version bump to release." | ||
| exit 0 | ||
| fi | ||
| publish: | ||
| needs: check-version | ||
| runs-on: ubuntu-latest | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| if: ${{ env.version_changed == 'true' }} | ||
| steps: | ||
| - uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: '20.x' | ||
| registry-url: 'https://registry.npmjs.org' | ||
| - run: npm ci | ||
| working-directory: tools/spectral/ipa | ||
| - run: npm publish --access public | ||
| working-directory: tools/spectral/ipa | ||
| env: | ||
| NODE_AUTH_TOKEN: ${{ secrets.IPA_VALIDATION_TOKEN }} | ||