Skip to content

Commit

Permalink
Extract version from pom
Browse files Browse the repository at this point in the history
  • Loading branch information
leonardehrenfried committed Nov 24, 2022
1 parent 4bcb63c commit 66629f5
Showing 1 changed file with 11 additions and 5 deletions.
16 changes: 11 additions & 5 deletions .github/workflows/cibuild.yml
Original file line number Diff line number Diff line change
Expand Up @@ -58,20 +58,23 @@ jobs:
docs:
if: github.repository_owner == 'opentripplanner' && github.event_name == 'push' && (github.ref == 'refs/heads/dev-2.x' || github.ref == 'refs/heads/master')
runs-on: ubuntu-latest
needs: build
#needs: build
env:
REMOTE: docs
LOCAL_BRANCH: local-pages
REMOTE_BRANCH: main
TOKEN: ${{ secrets.CHANGELOG_TOKEN }}
MASTER_BRANCH_VERSION: 2.2.0

steps:
- uses: actions/checkout@v3.1.0
with:
token: ${{ secrets.CHANGELOG_TOKEN }}
- name: Install Python dependencies
run: pip install -r docs/requirements.txt
- name: Install dependencies
run: |
pip install -r docs/requirements.txt
# install xmllint which we need to extract the version from the pom.xml
sudo apt-get install -y libxml2-utils
- name: Deploy docs to Github pages
run: |
git config --global user.name 'OTP Bot'
Expand All @@ -90,7 +93,10 @@ jobs:
if [ ${{ github.ref }} = 'refs/heads/master' ];
then
mike deploy --branch $LOCAL_BRANCH --prefix en --title=$MASTER_BRANCH_VERSION --update-aliases v$MASTER_BRANCH_VERSION latest
# we read the current version from the pom.xml, remove -SNAPSHOT and deploy to that, also setting 'latest' as an alias
VERSION_WITH_SNAPSHOT=`xmllint --xpath "/*[local-name()='project']/*[local-name()='version']/text()" pom.xml`
VERSION_WITHOUT_SNAPSHOT="${VERSION_WITH_SNAPSHOT/-SNAPSHOT/""}"
mike deploy --branch $LOCAL_BRANCH --prefix en --title=$VERSION_WITHOUT_SNAPSHOT --update-aliases v$VERSION_WITHOUT_SNAPSHOT latest
else
mike deploy --branch $LOCAL_BRANCH --prefix en dev-2.x
fi
Expand Down

0 comments on commit 66629f5

Please sign in to comment.