Merge pull request #76 from MxIris-Reverse-Engineering/ci/version-con… #3
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: Version Check | |
| on: | |
| push: | |
| branches: [main] | |
| pull_request: | |
| branches: [main] | |
| jobs: | |
| version-check: | |
| name: Verify version metadata | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Extract BundledVersion.value | |
| id: version | |
| run: | | |
| set -euo pipefail | |
| file="Sources/swift-section/Version.swift" | |
| value=$(grep -m1 -E 'static[[:space:]]+let[[:space:]]+value[[:space:]]*=[[:space:]]*"[^"]+"' "$file" | sed -E 's/.*"([^"]+)".*/\1/' || true) | |
| if [ -z "$value" ]; then | |
| echo "::error file=$file::Failed to extract BundledVersion.value" | |
| exit 1 | |
| fi | |
| echo "version=$value" >> "$GITHUB_OUTPUT" | |
| echo "BundledVersion.value = $value" | |
| - name: Verify matching changelog exists | |
| run: | | |
| set -euo pipefail | |
| value="${{ steps.version.outputs.version }}" | |
| changelog="Changelogs/$value.md" | |
| if [ ! -f "$changelog" ]; then | |
| echo "::error file=Sources/swift-section/Version.swift::Missing $changelog — every BundledVersion.value must have a matching changelog. Either create $changelog or adjust Version.swift." | |
| exit 1 | |
| fi | |
| echo "Found $changelog" |