Shine Registry Role Added #186
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 Increment Check | |
| on: | |
| pull_request: | |
| branches: | |
| - gh-pages # Ensure this matches your base branch | |
| jobs: | |
| check-version: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout destination branch (gh-pages) | |
| uses: actions/checkout@v5 | |
| with: | |
| ref: gh-pages | |
| path: base | |
| - name: Checkout pull request branch | |
| uses: actions/checkout@v5 | |
| with: | |
| path: pr | |
| - name: Extract version from base branch | |
| id: base_version | |
| run: | | |
| BASE_VERSION=$(grep '^version:' base/_config.yml | sed 's/version: //' | tr -d '[:space:]') | |
| echo "Base branch version: $BASE_VERSION" | |
| echo "VERSION=$BASE_VERSION" >> $GITHUB_ENV | |
| - name: Extract version from PR branch | |
| id: pr_version | |
| run: | | |
| PR_VERSION=$(grep '^version:' pr/_config.yml | sed 's/version: //' | tr -d '[:space:]') | |
| echo "Pull request branch version: $PR_VERSION" | |
| echo "VERSION_PR=$PR_VERSION" >> $GITHUB_ENV | |
| - name: Compare versions | |
| run: | | |
| echo "Comparing versions..." | |
| echo "Base: $VERSION, PR: $VERSION_PR" | |
| # Ensure both versions are extracted | |
| if [[ -z "$VERSION" || -z "$VERSION_PR" ]]; then | |
| echo "β Error: Could not extract versions properly." | |
| exit 1 | |
| fi | |
| # Check if the PR version is the same as the base version | |
| if [[ "$VERSION" == "$VERSION_PR" ]]; then | |
| echo "β Error: Version number has NOT changed! Please update _config.yml." | |
| exit 1 | |
| fi | |
| # Check if the new version is actually greater | |
| if [ "$(printf '%s\n' "$VERSION" "$VERSION_PR" | sort -V | tail -n 1)" != "$VERSION_PR" ]; then | |
| echo "β Error: Version number has not incremented! Please update _config.yml." | |
| exit 1 | |
| else | |
| echo "β Version increment check passed." | |
| fi | |
| env: | |
| VERSION: ${{ env.VERSION }} | |
| VERSION_PR: ${{ env.VERSION_PR }} |