Skip to content

Commit a1a5408

Browse files
committed
Update release actions
1 parent 1f56435 commit a1a5408

File tree

1 file changed

+34
-37
lines changed

1 file changed

+34
-37
lines changed

.github/workflows/release.yml

+34-37
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,9 @@ name: Release
33
on:
44
workflow_dispatch:
55

6+
env:
7+
postgis: 3
8+
vroom: 1.12.0
69

710
jobs:
811
release:
@@ -14,37 +17,25 @@ jobs:
1417

1518
steps:
1619
- name: Checkout repository
17-
uses: actions/checkout@v3
20+
uses: actions/checkout@v4
1821
with:
1922
fetch-depth: 0
2023

2124
- name: Get postgres version
2225
run: |
2326
sudo service postgresql start
24-
PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d \()')
27+
PGVER=$(psql --version | grep -Po '(?<=psql \(PostgreSQL\) )[^;]+(?=\.\d+ \()')
2528
PROJECT_VERSION=$(grep -Po '(?<=project\(VRPROUTING VERSION )[^;]+' CMakeLists.txt)
2629
echo "PGVER=${PGVER}" >> $GITHUB_ENV
2730
echo "PGPORT=5432" >> $GITHUB_ENV
28-
echo "PGIS=3" >> $GITHUB_ENV
2931
echo "PROJECT_VERSION=${PROJECT_VERSION}" >> $GITHUB_ENV
30-
echo "VROOMVER=1.12.0" >> $GITHUB_ENV
3132
32-
- name: Verify Tag Name
33+
- name: Create and Push Tag
3334
run: |
34-
TAG_NAME=${GITHUB_REF#refs/*/}
35-
echo "TAG_NAME=${TAG_NAME}" >> $GITHUB_ENV
36-
echo ${TAG_NAME}
37-
echo ${PROJECT_VERSION}
38-
if [ "${TAG_NAME}" != "v${PROJECT_VERSION}" ]; then
39-
echo "Tag name should be v${PROJECT_VERSION}"
40-
exit 1
41-
fi
42-
43-
- name: Extract branch name
44-
run: |
45-
raw=$(git branch -r --contains ${{ github.ref }})
46-
branch=${raw##*/}
47-
echo "BRANCH=$branch" >> $GITHUB_ENV
35+
git tag -a "v${PROJECT_VERSION}" -m "Release version ${PROJECT_VERSION}"
36+
git push origin "v${PROJECT_VERSION}"
37+
env:
38+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4839

4940
- name: Add PostgreSQL APT repository
5041
run: |
@@ -54,7 +45,7 @@ jobs:
5445
$(lsb_release -cs)-pgdg main" > /etc/apt/sources.list.d/pgdg.list'
5546
5647
- name: Install python
57-
uses: actions/setup-python@v2
48+
uses: actions/setup-python@v5
5849
with:
5950
python-version: '3.x'
6051

@@ -63,8 +54,8 @@ jobs:
6354
sudo apt-get update
6455
sudo apt-get install -y \
6556
postgresql-${PGVER} \
66-
postgresql-${PGVER}-postgis-${PGIS} \
67-
postgresql-${PGVER}-postgis-${PGIS}-scripts \
57+
postgresql-${PGVER}-postgis-${{ env.postgis }} \
58+
postgresql-${PGVER}-postgis-${{ env.postgis }}-scripts \
6859
postgresql-server-dev-${PGVER} \
6960
graphviz \
7061
doxygen
@@ -76,35 +67,41 @@ jobs:
7667
run: |
7768
sudo apt-get install libssl-dev libasio-dev libglpk-dev
7869
70+
- name: Install Google OR-Tools dependencies
71+
run: |
72+
sudo pip install --root=/ ortools
73+
7974
- name: Cache VROOM
8075
id: cache-vroom
81-
uses: actions/cache@v2
76+
uses: actions/cache@v4
8277
env:
8378
cache-name: vroom
8479
with:
85-
path: |
86-
~/vroom-${{ env.VROOMVER }}
87-
key: ${{ runner.os }}-${{ env.cache-name }}-${{ env.VROOMVER }}
80+
path: vroom-${{ env.vroom }}
81+
key: ${{ matrix.os }}-${{ env.cache-name }}-${{ env.vroom }}
82+
83+
- name: Checkout VROOM
84+
if: steps.cache-vroom.outputs.cache-hit != 'true'
85+
uses: actions/checkout@v4
86+
with:
87+
path: vroom-${{ env.vroom }}
88+
repository: VROOM-Project/vroom
89+
ref: "v${{ env.vroom }}"
90+
submodules: true
8891

8992
- name: Build VROOM
9093
if: steps.cache-vroom.outputs.cache-hit != 'true'
9194
run: |
92-
git clone --depth 1 --branch v${{ env.VROOMVER }} https://github.com/VROOM-Project/vroom ~/vroom-${{ env.VROOMVER }}
93-
94-
# init the required submodules
95-
cd ~/vroom-${{ env.VROOMVER }}/
96-
git submodule update --init
97-
98-
# Using "shared" target for creating Position Independent Code, disabling use of routing
99-
cd ~/vroom-${{ env.VROOMVER }}/src
95+
cd vroom-${{ env.vroom }}/src
10096
USE_ROUTING=false make shared
10197
10298
- name: Configure
10399
run: |
104100
export PATH=/usr/lib/postgresql/${PGVER}/bin:$PATH
101+
VROOM=$(pwd)/vroom-${{ env.vroom }}
105102
mkdir build
106103
cd build
107-
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 }} ..
104+
cmake -DPOSTGRESQL_VERSION=${PGVER} -DDOC_USE_BOOTSTRAP=ON -DWITH_DOC=ON -DBUILD_DOXY=ON -DCMAKE_BUILD_TYPE=Release -DES=ON -DVROOM_INSTALL_PATH=${VROOM} ..
108105
109106
- name: Build
110107
run: |
@@ -149,10 +146,10 @@ jobs:
149146
tar -zcvf doc-v${PROJECT_VERSION}-en.tar.gz doc-v${PROJECT_VERSION}-en
150147
151148
cd ../..
152-
grep -Pzo "(?s)v${PROJECT_VERSION//./\\.} Release Notes.*?(?=v.\..\.. Release Notes)" NEWS | tr '\0' '\n' > release_body.txt
149+
grep -Pzo "(?s)v${PROJECT_VERSION//./\\.} Release Notes.*?(?=v.\..\.. Release Notes)" NEWS.md | tr '\0' '\n' > release_body.txt
153150
154151
# Only executed during the first release
155-
grep -q '[^[:space:]]' < release_body.txt || cp NEWS release_body.txt
152+
grep -q '[^[:space:]]' < release_body.txt || cp NEWS.md release_body.txt
156153
157154
echo >> release_body.txt
158155
echo "**Attachments**" >> release_body.txt

0 commit comments

Comments
 (0)