Skip to content

Commit 7590929

Browse files
authored
feat(ipa): IPA Package config, docs and release workflow (#855)
1 parent 9e8cb9f commit 7590929

File tree

7 files changed

+418
-321
lines changed

7 files changed

+418
-321
lines changed
Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
#!/bin/bash
2+
set -eou pipefail
3+
4+
current_version=$(jq -r '.version' tools/spectral/ipa/package.json)
5+
6+
previous_version=$(git show origin/"${BASE_BRANCH}":tools/spectral/ipa/package.json | jq -r '.version')
7+
8+
if [[ -z "${previous_version}" || "${previous_version}" == "null" ]]; then
9+
previous_version="none"
10+
fi
11+
12+
if [[ "${previous_version}" == "${current_version}" ]]; then
13+
echo "false"
14+
else
15+
echo "true"
16+
fi

.github/workflows/ipa-changelog.yml

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,35 @@ jobs:
1414
- name: Checkout Repository
1515
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
1616
with:
17+
fetch-depth: 0
1718
sparse-checkout: |
18-
tools/spectral/ipa
19+
tools/spectral/ipa
20+
.github/scripts
1921
2022
- name: Fetch Versions
21-
working-directory: tools/spectral/ipa
2223
id: version_check
24+
env:
25+
BASE_BRANCH: ${{ github.event.pull_request.base.ref }}
2326
run: |
24-
current_version=$(jq '.version' package.json)
25-
echo "Current version: $current_version"
26-
27-
previous_version=$(git show origin/${{ github.event.pull_request.base.ref }}:tools/spectral/ipa/package.json | jq -r '.version')
28-
29-
if [[ -z "$previous_version" || "$previous_version" == "null" ]]; then
30-
previous_version="none"
31-
fi
32-
echo "Previous version: $previous_version"
33-
27+
version_changed=$(./.github/scripts/ipa_version_check.sh)
28+
echo "Version changed? ${version_changed}"
29+
echo "version_changed=${version_changed}" >> "${GITHUB_OUTPUT}"
3430
- name: Check Changelog
3531
working-directory: tools/spectral/ipa
3632
env:
37-
VERSION_BUMP: ${{ steps.version_check.outputs.current_version != steps.version_check.outputs.previous_version && 'true' || 'false' }}
33+
VERSION_BUMP: ${{ steps.version_check.outputs.version_changed }}
3834
run: |
3935
npm run gen-ipa-changelog
4036
4137
# Check for uncommitted changes specific to CHANGELOG.md
4238
uncommitted_changes=$(git status --porcelain | grep "CHANGELOG.md" || echo "")
4339
44-
if [[ "$VERSION_BUMP" == "false" && -n "$uncommitted_changes" ]]; then
40+
if [[ "${VERSION_BUMP}" == "false" && -n "${uncommitted_changes}" ]]; then
4541
echo "Error: Changelog should only be updated alongside a version bump. Please restore the changelog."
4642
exit 1
4743
fi
4844

49-
if [[ "$VERSION_BUMP" == "true" && -z "$uncommitted_changes" ]]; then
45+
if [[ "${VERSION_BUMP}" == "true" && -z "${uncommitted_changes}" ]]; then
5046
echo "Error: Changelog must be updated alongside a version bump. Please run 'npm run gen-ipa-changelog' from the ipa directory and commit the changes."
5147
exit 1
5248
fi

.github/workflows/ipa-release.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Release IPA Package
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
branches:
7+
- main
8+
paths:
9+
- 'tools/spectral/ipa/package.json'
10+
11+
jobs:
12+
check-version:
13+
runs-on: ubuntu-latest
14+
outputs:
15+
version_changed: ${{ steps.version_check.outputs.version_changed }}
16+
17+
steps:
18+
- name: Checkout Repository
19+
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
20+
with:
21+
fetch-depth: 0
22+
sparse-checkout: |
23+
tools/spectral/ipa
24+
.github/scripts
25+
- name: Fetch Versions
26+
id: version_check
27+
run: |
28+
version_changed=$(./.github/scripts/ipa_version_check.sh)
29+
echo "Version changed? ${version_changed}"
30+
echo "version_changed=${version_changed}" >> "${GITHUB_ENV}"
31+
32+
publish:
33+
needs: check-version
34+
runs-on: ubuntu-latest
35+
permissions:
36+
contents: read
37+
id-token: write
38+
if: ${{ needs.check-version.outputs.version_changed == 'true' }}
39+
40+
steps:
41+
- uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
42+
- uses: actions/setup-node@v4
43+
with:
44+
node-version: '20.x'
45+
registry-url: 'https://registry.npmjs.org'
46+
- run: npm ci
47+
working-directory: tools/spectral/ipa
48+
- run: npm publish --access public
49+
working-directory: tools/spectral/ipa
50+
env:
51+
NODE_AUTH_TOKEN: ${{ secrets.IPA_VALIDATION_TOKEN }}

CONTRIBUTING.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,5 @@ When working in the `tools/cli` directory:
6666
- `make e2e-test` - Run end-to-end tests
6767
- `make build` - Build the CLI binary
6868
- `make gen-docs` - Generate CLI documentation
69+
70+
**Note: Please ensure the usage of [conventional commits](https://www.conventionalcommits.org/en/v1.0.0/) in PR titles**

0 commit comments

Comments
 (0)