Skip to content

Commit cc386d6

Browse files
committed
Add version
1 parent 1ceeb00 commit cc386d6

File tree

1 file changed

+27
-5
lines changed

1 file changed

+27
-5
lines changed

.github/workflows/build.yaml

Lines changed: 27 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -31,9 +31,17 @@ jobs:
3131
needs:
3232
- package_linux
3333
runs-on: ubuntu-latest
34-
env:
35-
APP_VERSION: dev
3634
steps:
35+
- name: Extract Version Name
36+
id: extract_name
37+
uses: actions/github-script@v7
38+
with:
39+
result-encoding: string
40+
script: |
41+
if (context.payload.ref.startsWith('refs/tags/')) {
42+
return context.payload.ref.replace(/refs\/tags\/v/, '');
43+
}
44+
return 'dev';
3745
- name: Checkout code
3846
uses: actions/checkout@v4
3947
- name: Install rpm
@@ -47,11 +55,11 @@ jobs:
4755
- name: Move file
4856
run: mv LargeCsvReader.tar.xz rpm/SOURCES
4957
- name: Build RPM
50-
run: rpmbuild -ba --define "_topdir $(pwd)/rpm" --define "app_version $APP_VERSION" rpm/LargeCsvReader.spec
58+
run: rpmbuild -ba --define "_topdir $(pwd)/rpm" --define "app_version ${{ steps.extract_name.outputs.result }}" rpm/LargeCsvReader.spec
5159
- name: Upload artifact
5260
uses: actions/upload-artifact@v4
5361
with:
54-
path: rpm/RPMS/x86_64/LargeCsvReader-${{ env.APP_VERSION }}-1.x86_64.rpm
62+
path: rpm/RPMS/x86_64/LargeCsvReader-${{ steps.extract_name.outputs.result }}-1.x86_64.rpm
5563
name: rpm
5664

5765
build_win_installer:
@@ -60,12 +68,26 @@ jobs:
6068
- package_windows
6169
runs-on: windows-latest
6270
steps:
71+
- name: Extract Version Name
72+
id: extract_name
73+
uses: actions/github-script@v7
74+
with:
75+
result-encoding: string
76+
script: |
77+
if (context.payload.ref.startsWith('refs/tags/')) {
78+
return context.payload.ref.replace(/refs\/tags\/v/, '');
79+
}
80+
return 'dev';
6381
- name: Checkout Code
6482
uses: actions/checkout@v4
6583
- name: Download built
6684
uses: actions/download-artifact@v4
6785
with:
6886
name: windows-latest
87+
- name: Set version
88+
env:
89+
VERSION: ${{ steps.extract_name.outputs.result }}
90+
run: echo %VERSION% > appversion
6991
- name: Move file
7092
run: mv LargeCsvReader.exe windows
7193
- name: Create Windows setup
@@ -74,7 +96,7 @@ jobs:
7496
- name: Upload artifact
7597
uses: actions/upload-artifact@v4
7698
with:
77-
path: windows/LargeCsvReaderSetup.exe
99+
path: windows/Output/LargeCsvReaderSetup.exe
78100
name: win_installer
79101

80102
create_release:

0 commit comments

Comments
 (0)