Skip to content

Commit 059582f

Browse files
author
hiran
committed
calculate version number early in the build
1 parent e45bc49 commit 059582f

File tree

1 file changed

+54
-18
lines changed

1 file changed

+54
-18
lines changed

.github/workflows/build-all.yml

Lines changed: 54 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,3 @@
1-
21
name: build-all
32

43
on:
@@ -22,11 +21,33 @@ jobs:
2221
fetch-depth: 0
2322
submodules: true
2423

24+
- name: Calculate version number and set OOLITE_VERSION
25+
id: version
26+
run: |
27+
set -x
28+
cd oolite
29+
# Build version string,
30+
# taking into account that we may have just two digits
31+
VERSION=$(cat src/Cocoa/oolite-version.xcconfig | cut -d '=' -f 2)
32+
VER_MAJ=$(echo ${VERSION} | cut -d. -f1)
33+
VER_MIN=$(echo ${VERSION} | cut -d. -f2)
34+
VER_REV=$(echo ${VERSION} | cut -d. -f3)
35+
if [ "" == "${VER_REV}" ]
36+
then
37+
VER_REV="0"
38+
fi
39+
VER_DATE=$(date +%y%m%d)
40+
VER_GITREV=$(git rev-list --count HEAD)
41+
VER_GITHASH=$(git rev-parse --short=7 HEAD)
42+
VER="${VER_MAJ}.${VER_MIN}.${VER_REV}.${VER_GITREV}-${VER_DATE}-${VER_GITHASH}"
43+
echo "OOLITE_VERSION=${VER}" >> "$GITHUB_OUTPUT"
44+
echo "OOLITE_VERSION=${VER}" >> Doc/OOLITE_VERSION.txt
45+
2546
- name: generate PDFs
2647
run: |
2748
find oolite/Doc -name "*.odt" -exec soffice --headless --convert-to pdf:"writer_pdf_Export" --outdir oolite/Doc {} \;
28-
zip oolite-doc.zip oolite/Doc/*.pdf
29-
49+
zip oolite-doc.zip oolite/Doc/*.pdf oolite/Doc/OOLITE_VERSION.txt
50+
3051
- name: Archive generated documentation
3152
uses: actions/upload-artifact@v3
3253
with:
@@ -40,7 +61,7 @@ jobs:
4061
needs: [common-steps]
4162
steps:
4263
## This is for debugging only and helps developing the workflow.
43-
#- name: Environment Variables
64+
# - name: Environment Variables
4465
# run: |
4566
# printenv | sort
4667

@@ -61,7 +82,7 @@ jobs:
6182
with:
6283
name: oolite-doc
6384
path: artifacts
64-
85+
6586
- name: Extract PDFs
6687
run: |
6788
unzip -u artifacts/oolite-doc.zip
@@ -70,15 +91,15 @@ jobs:
7091
- name: show filesystem before build
7192
run: |
7293
find . -not -path "./oolite/deps/Windows-deps/*" -not -path "./oolite/Mac-specific/*" -not -path "./oolite/.git/*"
73-
94+
7495
- name: compiling up to installer script (.run file)
7596
run: |
7697
cd oolite
7798
source /usr/share/GNUstep/Makefiles/GNUstep.sh
7899
make -f Makefile pkg-posix-nightly HOST_ARCH=$(uname -m)
79-
100+
80101
## This is for debugging only and helps developing the workflow.
81-
#- name: show filesystem after build
102+
# - name: show filesystem after build
82103
# run: |
83104
# find . -not -path "./oolite/Mac-specific/*" -not -path "./oolite/deps/Windows-deps/*" -not -path "./oolite/tests/*" -not -path "./oolite/.git/*" -not -path "./oolite/deps/mozilla/*"
84105

@@ -91,34 +112,34 @@ jobs:
91112
run: |
92113
NAME=$(basename oolite-nightly/oolite-*.run .run)
93114
tar cvfz ${NAME}.tgz -C oolite-nightly .
94-
115+
95116
# This is for debugging only and helps developing the workflow.
96117
- name: show filesystem after installer
97118
run: |
98119
find . -not -path "./oolite/Mac-specific/*" -not -path "./oolite/deps/*" -not -path "./oolite/tests/*" -not -path "./oolite/.git/*"
99-
120+
100121
- name: Archive build tar ball
101122
uses: actions/upload-artifact@v3
102123
with:
103124
name: oolite-linux-nightly
104125
path: |
105126
oolite-*.tgz
106127
retention-days: 5
107-
128+
108129

109130
build-windows:
110131
runs-on: windows-latest
111132
needs: [common-steps]
112133
steps:
113134
## This is for debugging only and helps developing the workflow.
114-
#- name: Environment Variables
135+
# - name: Environment Variables
115136
# run: |
116137
# Get-ChildItem Env: | Sort Name
117138

118139
- name: Checkout DevelopmentEnvironment
119140
uses: actions/checkout@v3
120141
with:
121-
repository: OoliteProject/oolite-windows-build-env
142+
repository: OoliteProject/oolite-windows-build-env
122143
path: DevelopmentEnvironment
123144

124145
- name: Checkout Oolite
@@ -133,7 +154,7 @@ jobs:
133154
with:
134155
name: oolite-doc
135156
path: artifacts
136-
157+
137158
- name: Extract PDFs
138159
run: |
139160
unzip -u artifacts/oolite-doc.zip
@@ -147,7 +168,7 @@ jobs:
147168
- name: Compile
148169
shell: cmd
149170
run: D:\a\oolite\oolite\DevelopmentEnvironment\gcc\Msys_x2\1.0\msys.cmd
150-
171+
151172
# check http://aegidian.org/bb/viewtopic.php?p=281821#p281821
152173
# this is for debug only; it creates huge logs and takes a long time to execute, yet you never know when you need it
153174
- name: check filesystem
@@ -164,6 +185,7 @@ jobs:
164185

165186
build-doxygen:
166187
runs-on: ubuntu-latest
188+
needs: [common-steps]
167189
steps:
168190
- name: Checkout Oolite
169191
uses: actions/checkout@v3
@@ -172,13 +194,27 @@ jobs:
172194
fetch-depth: 0
173195
submodules: true
174196

197+
- name: Download artifacts
198+
uses: actions/download-artifact@v3
199+
with:
200+
name: oolite-doc
201+
path: artifacts
202+
203+
- name: Extract PDFs
204+
run: |
205+
unzip -u artifacts/oolite-doc.zip
206+
207+
- name: print version
208+
run: |
209+
cat oolite/Doc/OOLITE_VERSION.txt
210+
175211
- name: Run doxygen
176212
uses: mattnotmitt/[email protected]
177213
with:
178214
working-directory: oolite
179215

180216
## This is for debugging only and helps developing the workflow.
181-
#- name: Environment Variables 1
217+
# - name: Environment Variables 1
182218
# run: |
183219
# printenv | sort
184220
# find . -not -path "./oolite/deps/*" -not -path "./oolite/Mac-specific/*" -not -path "./oolite/.git/*"
@@ -203,7 +239,7 @@ jobs:
203239
runs-on: ubuntu-latest
204240
steps:
205241
## This is for debugging only and helps developing the workflow.
206-
#- name: Environment Variables
242+
# - name: Environment Variables
207243
# run: |
208244
# printenv | sort
209245

@@ -216,7 +252,7 @@ jobs:
216252
- name: show filesystem after download
217253
run: |
218254
find .
219-
255+
220256
# For changes on master branch, create a new release.
221257
# It should move the 'latest' tag automatically.
222258
- name: Create Release

0 commit comments

Comments
 (0)