Skip to content

Commit

Permalink
Update release actions
Browse files Browse the repository at this point in the history
  • Loading branch information
krashish8 committed Sep 29, 2024
1 parent 1f56435 commit d1ba0f0
Showing 1 changed file with 39 additions and 42 deletions.
81 changes: 39 additions & 42 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,9 @@ name: Release
on:
workflow_dispatch:

env:
postgis: 3
vroom: 1.12.0

jobs:
release:
Expand All @@ -14,37 +17,30 @@ 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
- name: Create and Push Tag
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
git tag -a "v${PROJECT_VERSION}" -m "Release version ${PROJECT_VERSION}"
git push origin "v${PROJECT_VERSION}"
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Add PostgreSQL APT repository
run: |
Expand All @@ -54,7 +50,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'

Expand All @@ -63,8 +59,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
Expand All @@ -76,35 +72,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: |
Expand All @@ -114,11 +116,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
Expand Down Expand Up @@ -149,10 +146,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)v${PROJECT_VERSION//./\\.} Release Notes.*?(?=v.\..\.. Release Notes)" 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
Expand Down

0 comments on commit d1ba0f0

Please sign in to comment.