ci(ipa): release new version 4.0.0 (#933) #40
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: | |
| inputs: | |
| workflow_call: | |
| description: 'To distinguish workflow_call from regular push' | |
| type: boolean | |
| required: false | |
| default: true | |
| use_existing_tag: | |
| description: 'Set value to `true` to use an existing tag for the release process, default is `false`' | |
| default: 'false' | |
| push: | |
| branches: | |
| - main | |
| paths: | |
| - 'tools/spectral/ipa/package.json' | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version_changed: ${{ steps.version_check.outputs.version_changed }} | |
| current_version: ${{ steps.version_check.outputs.current_version }} | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| with: | |
| fetch-depth: 0 | |
| sparse-checkout: | | |
| tools/spectral/ipa | |
| .github/scripts | |
| - name: Fetch Versions | |
| id: version_check | |
| env: | |
| BASE_BRANCH: "main~1" | |
| run: | | |
| version_changed=$(./.github/scripts/ipa_version_check.sh) | |
| echo "Version changed? ${version_changed}" | |
| echo "version_changed=${version_changed}" >> "${GITHUB_OUTPUT}" | |
| current_version=$(jq -r '.version' tools/spectral/ipa/package.json) | |
| echo "Current version: ${current_version}" | |
| echo "current_version=${current_version}" >> "${GITHUB_OUTPUT}" | |
| create-tag: | |
| runs-on: ubuntu-latest | |
| needs: check-version | |
| if: >- | |
| !cancelled() | |
| && (!inputs.use_existing_tag || inputs.use_existing_tag == 'false') | |
| && needs.check-version.outputs.version_changed == 'true' | |
| steps: | |
| - name: Validation of version format | |
| run: | | |
| echo "${{ needs.check-version.outputs.current_version }}" | grep -P '^\d+\.\d+\.\d+$' | |
| - name: Checkout | |
| uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - name: Get the latest commit SHA | |
| id: get-sha | |
| run: echo "sha=$(git rev-parse HEAD)" >> "$GITHUB_OUTPUT" | |
| - name: Create release tag | |
| uses: rickstaa/action-create-tag@a1c7777fcb2fee4f19b0f283ba888afa11678b72 | |
| with: | |
| tag: 'ipa-validation-ruleset-v${{ needs.check-version.outputs.current_version }}' | |
| commit_sha: ${{ steps.get-sha.outputs.sha }} | |
| gpg_private_key: ${{ secrets.GPG_PRIVATE_KEY }} | |
| gpg_passphrase: ${{ secrets.PASSPHRASE }} | |
| publish: | |
| needs: check-version | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| id-token: write | |
| if: ${{ needs.check-version.outputs.version_changed == 'true' || inputs.workflow_call }} | |
| steps: | |
| - uses: actions/checkout@08c6903cd8c0fde910a37f88322edcfb5dd907a8 | |
| - 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_NPM_TOKEN }} | |