Skip to content

Release new OTP version 🛠️ #495

Release new OTP version 🛠️

Release new OTP version 🛠️ #495

name: "A - Release new OTP version 🛠️"
run-name: "Release new OTP version 🛠️"
on:
schedule:
- cron: '33 0 * * 1-5'
workflow_dispatch:
branches:
- main
inputs:
log_level:
description: 'Log level'
required: true
default: 'info'
type: choice
options:
- info
- debug
bump_ser_ver_id:
description: 'Force bumping the ser.ver.id'
default: false
type: boolean
hotfix:
description: '🌶️ Hotfix! Specify the "as is" branch to release. No changes applied.'
default: false
type: boolean
workflow_call:
inputs:
log_level:
type: string
default: 'info'
outputs:
version:
description: 'The OTP version'
value: ${{ jobs.release.outputs.version }}
ser_ver_id:
description: 'The OTP serialization id'
value: ${{ jobs.release.outputs.ser_ver_id }}
jobs:
release:
runs-on: ubuntu-latest
# This condition ensures the job only runs if the branch is 'main'
if: github.ref == 'refs/heads/main'
outputs:
version: ${{ steps.set_version.outputs.version }}
ser_ver_id: ${{ steps.set_ser_ver_id.outputs.ser_ver_id }}
steps:
- name: Checkout entur/OpenTripPlanner
uses: actions/checkout@v4
with:
fetch-depth: 0
token: '${{ secrets.ENTUR_OTP_CI_BUILD }}'
- uses: actions/setup-python@v5
with:
python-version: '3.13'
- uses: actions/setup-java@v4
with:
java-version: 25
distribution: temurin
- name: Cache Maven dependencies
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-${{ hashFiles('**/pom.xml') }}
${{ runner.os }}-maven-
${{ runner.os }}-
- name: Release OTP
env:
CUSTOM_RELEASE_GIT_HUB_API_TOKEN: ${{ secrets.ENTUR_OTP_CI_BUILD }}
CUSTOM_RELEASE_LOG_LEVEL: ${{ inputs.log_level }}
run: |
echo "Start otp release script"
git config user.name github-actions[bot]
git config user.email 41898282+github-actions[bot]@users.noreply.github.com
git remote rename origin entur
git remote add otp https://github.com/opentripplanner/OpenTripPlanner.git
git fetch --no-tags otp
git remote -v
if [ "${{inputs.bump_ser_ver_id}}" == "true" ]; then
SER_VER="--serVerId"
fi
if [ "${{inputs.hotfix}}" == "true" ]; then
script/custom-release.py --summary --release $SER_VER
else
script/custom-release.py --summary $SER_VER otp/dev-2.x
fi
- name: Set version (Git repository Tag)
id: set_version
run: |
VERSION_GIT_TAG=$(git describe --exact-match HEAD)
echo "Set 'version=${VERSION_GIT_TAG}'"
echo "version=${VERSION_GIT_TAG}" >> $GITHUB_OUTPUT
- name: Set serialization version ID
id: set_ser_ver_id
run: |
SER_VER_ID=$(mvn help:evaluate -Dexpression=otp.serialization.version.id -q -DforceStdout)
echo "Set ser_ver_id=${SER_VER_ID}"
echo "ser_ver_id=${SER_VER_ID}" >> $GITHUB_OUTPUT
- name: Create Summary
run: cat .custom_release_summary.md >> $GITHUB_STEP_SUMMARY
- name: Create GitHub Release
env:
GITHUB_TOKEN: ${{ secrets.ENTUR_OTP_CI_BUILD }}
run: |
TAG_NAME=${{ steps.set_version.outputs.version }}
SER_VER_ID=${{ steps.set_ser_ver_id.outputs.ser_ver_id }}
gh release create "$TAG_NAME" \
--title "Release ${TAG_NAME} (${SER_VER_ID})" \
--notes-file .custom_release_summary.md