Skip to content

fix: ensure cars start with brakes pressed #2

fix: ensure cars start with brakes pressed

fix: ensure cars start with brakes pressed #2

Workflow file for this run

name: Version Release
on:
pull_request:
types: [closed]
branches: [master]
jobs:
bump-semver:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Ensure full history for diff comparisons
- name: Run bump semver script
run: |
chmod +x ./.github/bump_version.sh
./.github/bump_version.sh "${{ github.event.pull_request.title }}"
- name: Commit version bump
run: |
git config user.name "GitHub Actions"
git config user.email "actions@github.com"
git add VERSION
git diff-index --quiet HEAD || git commit -m "Bump version to $(cat VERSION) [skip ci]"
git push origin HEAD:master --follow-tags
evaluate-release:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
needs: bump-semver
steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 0 # Get full history for tag comparison
- name: Read raw version
id: version
run: |
VERSION=$(cat VERSION)
echo "raw_version=${VERSION}" >> $GITHUB_OUTPUT
- name: Get previous tag
id: previous-tag
run: |
git fetch --tags
# Default to v0.0.0 if no tags exist
PREV_TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo "v0.0.0")
echo "prev_tag=${PREV_TAG}" >> $GITHUB_OUTPUT
echo "prev_version=${PREV_TAG#v}" >> $GITHUB_OUTPUT
- name: Compare versions
id: version-check
run: |
NEW_VERSION=${{ steps.version.outputs.raw_version }}
PREV_VERSION=${{ steps.previous-tag.outputs.prev_version }}
IFS='.' read -ra NEW <<< "$NEW_VERSION"
IFS='.' read -ra PREV <<< "$PREV_VERSION"
# Major/minor check (ignore patch)
if [[ ${NEW[0]} -gt ${PREV[0]} || (${NEW[0]} -eq ${PREV[0]} && ${NEW[1]} -gt ${PREV[1]}) ]];
then
echo "RELEASE_NEEDED=true" >> $GITHUB_ENV
echo "new_tag=v${NEW_VERSION}" >> $GITHUB_ENV
fi
- name: Create semver tag and release
if: env.RELEASE_NEEDED == 'true'
uses: actions/create-release@v1
with:
tag_name: ${{ env.new_tag }}
release_name: ${{ env.new_tag }}
draft: false
prerelease: false
generate_release_notes: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}