Skip to content

Commit a171463

Browse files
committed
Do not hardcode the version number in the build workflow.
To run the build workflow, we need to know the current version number (since the name of the source distribution archive includes it). Instead of hardcoding, try getting it from the configure.ac script, and pass it to the jobs/steps that need it.
1 parent 70acb2e commit a171463

1 file changed

Lines changed: 10 additions & 5 deletions

File tree

.github/workflows/build.yml

Lines changed: 10 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,14 @@ jobs:
1111
build_linux:
1212
name: Build the source distribution
1313
runs-on: ubuntu-latest
14+
outputs:
15+
odkrun_version: ${{ steps.find_version.outputs.odkrun_version }}
1416
steps:
1517
- name: Check out the repository
1618
uses: actions/checkout@v4
19+
- id: find_version
20+
name: Determine current version
21+
run: sed -E -e 's/^AC_INIT\(\[ODK Runner\], \[(.*)\],/odkrun_version=\1/;q' configure.ac >> "$GITHUB_OUTPUT"
1722
- name: Generate the build system
1823
run: autoreconf --install
1924
- name: Configure the distribution
@@ -24,7 +29,7 @@ jobs:
2429
uses: actions/upload-artifact@v4
2530
with:
2631
name: source_dist
27-
path: odkrun-0.4.1.tar.gz
32+
path: odkrun-${{ steps.find_version.outputs.odkrun_version }}.tar.gz
2833

2934
build_macos:
3035
name: Build for macOS
@@ -37,8 +42,8 @@ jobs:
3742
name: source_dist
3843
- name: Build
3944
run: |
40-
tar xf odkrun-0.4.1.tar.gz
41-
cd odkrun-0.4.1
45+
tar xf odkrun-${{ needs.build_linux.outputs.odkrun_version }}.tar.gz
46+
cd odkrun-${{ needs.build_linux.outputs.odkrun_version }}
4247
./configure
4348
make
4449
@@ -57,7 +62,7 @@ jobs:
5762
name: source_dist
5863
- name: Build
5964
run: |
60-
tar xf odkrun-0.4.1.tar.gz
61-
cd odkrun-0.4.1
65+
tar xf odkrun-${{ needs.build_linux.outputs.odkrun_version }}.tar.gz
66+
cd odkrun-${{ needs.build_linux.outputs.odkrun_version }}
6267
./configure --host=x86_64-w64-mingw32
6368
make

0 commit comments

Comments
 (0)