From 09cfd7aa47e813dc189efcb86b240f881cad8f35 Mon Sep 17 00:00:00 2001 From: Matt Thalman Date: Tue, 19 Mar 2024 19:09:27 -0500 Subject: [PATCH] Store statically-defined product version --- .github/workflows/release.yml | 50 +++++++++++++++++++++++++---------- version.txt | 1 + 2 files changed, 37 insertions(+), 14 deletions(-) create mode 100644 version.txt diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 8cc36ee..872d40a 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -2,10 +2,6 @@ name: Release on: workflow_dispatch: - inputs: - packageVersion: - description: 'Package version' - required: true env: REGISTRY: ghcr.io @@ -16,9 +12,37 @@ defaults: working-directory: src jobs: + + init: + name: Initialize + runs-on: ubuntu-latest + + outputs: + product-version: ${{ steps.version.outputs.product-version }} + + steps: + - uses: actions/checkout@v3 + + - name: Get Version + id: version + working-directory: ./ + run: | + ls + echo "product-version=$(cat version.txt)" >> $GITHUB_OUTPUT + + test: + name: Test + runs-on: ubuntu-latest + needs: init + + steps: + - run: echo "hi: ${{ needs.init.outputs.product-version }}" + + exe: name: Build executables runs-on: ubuntu-latest + needs: init strategy: matrix: @@ -56,7 +80,7 @@ jobs: dredgeExt="" fi - exeName="dredge-${{ github.event.inputs.packageVersion }}-${{ matrix.rid }}${dredgeExt}" + exeName="dredge-${{ needs.init.outputs.product-version }}-${{ matrix.rid }}${dredgeExt}" echo "EXE_NAME=${exeName}" >> $GITHUB_ENV mv ${{ github.workspace }}/publish/dredge${dredgeExt} ${{ github.workspace }}/publish/${exeName} rm ${{ github.workspace }}/publish/dredge.pdb @@ -115,12 +139,10 @@ jobs: run: dotnet build -c Release --no-restore Valleysoft.Dredge - name: Pack - env: - PACKAGE_VERSION: ${{ github.event.inputs.packageVersion }} - run: dotnet pack -c Release -p:Version=$PACKAGE_VERSION Valleysoft.Dredge -p:IsPack=true + run: dotnet pack -c Release -p:Version=${{ needs.init.outputs.product-version }} Valleysoft.Dredge -p:IsPack=true - - name: Publish Package - run: dotnet nuget push "Valleysoft.Dredge/bin/Release/*.nupkg" -k ${{secrets.NUGET_ORG_API_KEY}} -s https://nuget.org + # - name: Publish Package + # run: dotnet nuget push "Valleysoft.Dredge/bin/Release/*.nupkg" -k ${{secrets.NUGET_ORG_API_KEY}} -s https://nuget.org docker: name: Publish Docker Image @@ -129,7 +151,7 @@ jobs: steps: - uses: actions/checkout@v3 - + - name: Log in to the Container registry uses: docker/login-action@v2 with: @@ -148,7 +170,7 @@ jobs: with: context: ./src platforms: linux/amd64,linux/arm64 - push: true - tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ github.event.inputs.packageVersion }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest + push: false + tags: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:${{ needs.init.outputs.product-version }},${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}:latest build-args: | - PACKAGE_VERSION=${{ github.event.inputs.packageVersion }} + PACKAGE_VERSION=${{ needs.init.outputs.product-version }} diff --git a/version.txt b/version.txt new file mode 100644 index 0000000..7e961f9 --- /dev/null +++ b/version.txt @@ -0,0 +1 @@ +4.3.2 \ No newline at end of file