HYPERFLEET-1103 - feat: make statuses core only #93
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: CI | |
| on: | |
| pull_request: | |
| push: | |
| branches: | |
| - main | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| permissions: | |
| contents: read | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v6 | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: '20' | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build core schema | |
| run: ./build-schema.sh | |
| - name: Check schema consistency | |
| run: | | |
| if ! git diff --exit-code schemas/; then | |
| echo "Committed schemas are out of sync with TypeSpec sources." | |
| echo "Run './build-schema.sh' and commit the results." | |
| exit 1 | |
| fi | |
| - name: Lint OpenAPI schema | |
| run: | | |
| npx spectral lint schemas/core/openapi.yaml --format github-actions --fail-severity warn | |
| - name: Check version bump | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| CURRENT=$(grep -oP '(?<=version: ")[^"]+' main.tsp) | |
| if [ -z "$CURRENT" ]; then | |
| echo "::error::Failed to extract version from main.tsp — check the @info decorator format" >&2 | |
| exit 1 | |
| fi | |
| LATEST=$(gh release list --limit 1 --json tagName --jq '.[0].tagName' 2>/dev/null | sed 's/^v//' || echo "") | |
| if [ -z "$LATEST" ]; then | |
| echo "No previous releases found — version check skipped" | |
| exit 0 | |
| fi | |
| HIGHEST=$(printf '%s\n%s\n' "$CURRENT" "$LATEST" | sort -V | tail -1) | |
| if [ "$CURRENT" = "$LATEST" ]; then | |
| echo "::error::Version '$CURRENT' matches latest release tag 'v$LATEST' — bump the version in main.tsp before merging." | |
| exit 1 | |
| elif [ "$HIGHEST" != "$CURRENT" ]; then | |
| echo "::error::Version '$CURRENT' is lower than latest release 'v$LATEST' — version in main.tsp must be strictly greater." | |
| exit 1 | |
| fi | |
| echo "Version bump OK: $LATEST → $CURRENT" |