Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
25 changes: 14 additions & 11 deletions .github/workflows/ipa-changelog.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,20 +32,23 @@ jobs:
env:
VERSION_BUMP: ${{ steps.version_check.outputs.version_changed }}
run: |
npm run gen-ipa-changelog

# Check for uncommitted changes specific to CHANGELOG.md
uncommitted_changes=$(git status --porcelain | grep "CHANGELOG.md" || echo "")

diff_changelog=$(git diff -- tools/spectral/ipa/CHANGELOG.md || echo "")
diff_changelog=$(git diff origin/main -- CHANGELOG.md || echo "")

echo "Changelog diff: ${diff_changelog}"

if [[ "${VERSION_BUMP}" == "false" && -n "${uncommitted_changes}" ]]; then
if [[ "${VERSION_BUMP}" == "false" && -n "${diff_changelog}" ]]; then
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Disallow any changes to changelog if version is not bumped

echo "Error: Changelog should only be updated alongside a version bump. Please restore the changelog."
exit 1
fi

if [[ "${VERSION_BUMP}" == "true" && -n "${diff_changelog}" ]]; then
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."

npm run gen-ipa-changelog

# Check CHANGELOG.md is the generated changelog result
uncommitted_changes=$(git status --porcelain | grep "CHANGELOG.md" || echo "")

if [[ "${VERSION_BUMP}" == "true" && -n "${uncommitted_changes}" ]]; then
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

When version is bumped, ensure generated changelog is the same as committed

echo "Error: Changelog is not the same as the generated result. Please run 'npm run gen-ipa-changelog' from the ipa directory and commit the changes."
exit 1
fi
exit 0

exit 0
30 changes: 29 additions & 1 deletion .github/workflows/ipa-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@ on:
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
Expand All @@ -19,6 +22,7 @@ jobs:
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
Expand All @@ -36,7 +40,31 @@ jobs:
version_changed=$(./.github/scripts/ipa_version_check.sh)
echo "Version changed? ${version_changed}"
echo "version_changed=${version_changed}" >> "${GITHUB_OUTPUT}"

echo "current_version=${jq -r '.version' tools/spectral/ipa/package.json}" >> "${GITHUB_OUTPUT}"

create-tag:
runs-on: ubuntu-latest
needs: check-version
if: >-
!cancelled()
&& inputs.use_existing_tag == 'false'
steps:
- name: Validation of version format
run: |
echo "${{ needs.check-version.outputs.current_version }}" | grep -P '^\d+\.\d+\.\d+$'
- name: Checkout
uses: actions/checkout@692973e3d937129bcbf40652eb9f2f61becf3332
- 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
Expand Down
12 changes: 6 additions & 6 deletions tools/spectral/ipa/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,13 +36,13 @@
"auto-changelog": "2.5.0"
},
"auto-changelog" : {
"package" : true,
"package": true,
"commitPattern": "[a-z]+\\(ipa\\):",
"startingVersion" : "0.0.1",
"hideCredit": true,
"tagPattern": "none",
"startingVersion": "ipa-validation-ruleset-v1.0.0",
"hideCredit": true,
"tagPattern": "ipa-validation-ruleset-v\\d+\\.\\d+\\.\\d+",
"tagPrefix": "ipa-validation-ruleset-v",
"hideEmptyReleases" : true,
"contributors": false,
"changeCount": 0
"contributors": false
Comment on lines +39 to +46
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Adjust to use tag prefix for changelog

}
}
Loading