diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2db824d02..4620cad1d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,6 +3,9 @@ name: Release on: workflow_dispatch: +env: + postgis: 3 + vroom: 1.12.0 jobs: release: @@ -14,37 +17,24 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v3 + uses: actions/checkout@v4 with: fetch-depth: 0 + - name: Initialize mandatory git config + run: | + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + - name: Get postgres version run: | sudo service postgresql start - PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d \()') + PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()') PROJECT_VERSION=$(grep -Po '(?<=project\(VRPROUTING VERSION )[^;]+' CMakeLists.txt) echo "PGVER=${PGVER}" >> $GITHUB_ENV echo "PGPORT=5432" >> $GITHUB_ENV - echo "PGIS=3" >> $GITHUB_ENV echo "PROJECT_VERSION=${PROJECT_VERSION}" >> $GITHUB_ENV - echo "VROOMVER=1.12.0" >> $GITHUB_ENV - - - name: Verify Tag Name - run: | - TAG_NAME=${GITHUB_REF#refs/*/} - echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV - echo ${TAG_NAME} - echo ${PROJECT_VERSION} - if [ "${TAG_NAME}" != "v${PROJECT_VERSION}" ]; then - echo "Tag name should be v${PROJECT_VERSION}" - exit 1 - fi - - - name: Extract branch name - run: | - raw=$(git branch -r --contains ${{ github.ref }}) - branch=${raw##*/} - echo "BRANCH=$branch" >> $GITHUB_ENV + echo "TAG_NAME=v${PROJECT_VERSION}" >> $GITHUB_ENV - name: Add PostgreSQL APT repository run: | @@ -54,7 +44,7 @@ jobs: $(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list' - name: Install python - uses: actions/setup-python@v2 + uses: actions/setup-python@v5 with: python-version: '3.x' @@ -63,8 +53,8 @@ jobs: sudo apt-get update sudo apt-get install -y \ postgresql-${PGVER} \ - postgresql-${PGVER}-postgis-${PGIS} \ - postgresql-${PGVER}-postgis-${PGIS}-scripts \ + postgresql-${PGVER}-postgis-${{ env.postgis }} \ + postgresql-${PGVER}-postgis-${{ env.postgis }}-scripts \ postgresql-server-dev-${PGVER} \ graphviz \ doxygen @@ -76,35 +66,41 @@ jobs: run: | sudo apt-get install libssl-dev libasio-dev libglpk-dev + - name: Install Google OR-Tools dependencies + run: | + sudo pip install --root=/ ortools + - name: Cache VROOM id: cache-vroom - uses: actions/cache@v2 + uses: actions/cache@v4 env: cache-name: vroom with: - path: | - ~/vroom-${{ env.VROOMVER }} - key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.VROOMVER }} + path: vroom-${{ env.vroom }} + key: ${{ matrix.os }}-${{ env.cache-name }}-${{ env.vroom }} + + - name: Checkout VROOM + if: steps.cache-vroom.outputs.cache-hit != 'true' + uses: actions/checkout@v4 + with: + path: vroom-${{ env.vroom }} + repository: VROOM-Project/vroom + ref: "v${{ env.vroom }}" + submodules: true - name: Build VROOM if: steps.cache-vroom.outputs.cache-hit != 'true' run: | - git clone --depth 1 --branch v${{ env.VROOMVER }} https://github.com/VROOM-Project/vroom ~/vroom-${{ env.VROOMVER }} - - # init the required submodules - cd ~/vroom-${{ env.VROOMVER }}/ - git submodule update --init - - # Using "shared" target for creating Position Independent Code, disabling use of routing - cd ~/vroom-${{ env.VROOMVER }}/src + cd vroom-${{ env.vroom }}/src USE_ROUTING=false make shared - name: Configure run: | export PATH=/usr/lib/postgresql/${PGVER}/bin:$PATH + VROOM=$(pwd)/vroom-${{ env.vroom }} mkdir build cd build - cmake -DPOSTGRESQL_VERSION=${PGVER} -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=ON -DCMAKE_BUILD_TYPE=Release -DES=ON -DVROOM_INSTALL_PATH=$HOME/vroom-${{ env.VROOMVER }} .. + cmake -DPOSTGRESQL_VERSION=${PGVER} -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=ON -DCMAKE_BUILD_TYPE=Release -DES=ON -DVROOM_INSTALL_PATH=${VROOM} .. - name: Build run: | @@ -114,11 +110,6 @@ jobs: sudo make install make doxy - - name: Initialize mandatory git config - run: | - git config user.name "github-actions[bot]" - git config user.email "41898282+github-actions[bot]@users.noreply.github.com" - - name: Update Users Documentation run: | git checkout origin/gh-pages @@ -149,10 +140,10 @@ jobs: tar -zcvf doc-v${PROJECT_VERSION}-en.tar.gz doc-v${PROJECT_VERSION}-en cd ../.. - grep -Pzo "(?s)v${PROJECT_VERSION//./\\.} Release Notes.*?(?=v.\..\.. Release Notes)" NEWS | tr '\0' '\n' > release_body.txt + grep -Pzo "(?s)### vrpRouting ${PROJECT_VERSION//./\\.} Release Notes.*?(?=## vrpRouting)" NEWS.md | tr '\0' '\n' > release_body.txt # Only executed during the first release - grep -q '[^[:space:]]' < release_body.txt || cp NEWS release_body.txt + grep -q '[^[:space:]]' < release_body.txt || cp NEWS.md release_body.txt echo >> release_body.txt echo "**Attachments**" >> release_body.txt @@ -167,7 +158,7 @@ jobs: uses: softprops/action-gh-release@v1 with: body_path: release_body.txt - name: ${{ env.TAG_NAME }} + tag_name: ${{ env.TAG_NAME }} draft: true prerelease: false files: |