From ad667ab719171a14ff4d8256e0a2ae7d31328df3 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ingo=20Bre=C3=9Fler?= Date: Mon, 10 Feb 2025 14:14:26 +0100 Subject: [PATCH] chore(GHA): handling version string --- .github/workflows/build.yml | 32 +++++++++++++++++++++++++++----- 1 file changed, 27 insertions(+), 5 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 14504a1..75bba03 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -10,7 +10,26 @@ on: workflow_dispatch: jobs: + version: + runs-on: 'ubuntu-latest' + outputs: + version: ${{ steps.version.outputs.version }} + steps: + - name: Checking out the repo + uses: actions/checkout@v4 + + - name: Figure out version string + id: version + shell: sh + run: | + # get the latest commit hash in the short form + COMMIT=$(git rev-parse --short HEAD) + # get the latest commit date in the form of YYYYmmdd + DATE=$(git log -1 --format=%cd --date=format:'%y%m%d') + echo "version=${DATE}-${COMMIT}" >> "$GITHUB_OUTPUT" + build: + needs: [version] # convert this to a matrix if builds differ between platforms runs-on: ${{ matrix.os }} strategy: @@ -38,14 +57,12 @@ jobs: python -m pip install pyinstaller - name: Build + env: + VERSION: ${{needs.version.outputs.version}} shell: sh run: | - # get the latest commit hash in the short form - COMMIT=$(git rev-parse --short HEAD) - # get the latest commit date in the form of YYYYmmdd - DATE=$(git log -1 --format=%cd --date=format:'%y%m%d') OS=${{ matrix.os }} - sed -i -e "s/\(name='\)\(.*\)\(',\)/\1\2-$DATE-$COMMIT-${OS%-*}\3/" LiveFT.spec + sed -i -e "s/\(name='\)\(.*\)\(',\)/\1\2-$VERSION-${OS%-*}\3/" LiveFT.spec pyinstaller LiveFT.spec - name: Store built packages for publishing later @@ -66,6 +83,11 @@ jobs: path: dist - name: Check contents run: pwd; ls -la; ls -la dist + - name: Get version string + env: + VERSION: ${{needs.version.outputs.version}} + run: | + echo "version: '$VERSION'" # publish: # needs: [build]