Skip to content

Commit

Permalink
Store statically-defined product version
Browse files Browse the repository at this point in the history
  • Loading branch information
mthalman committed Mar 20, 2024
1 parent fd43363 commit 5cb2fe4
Show file tree
Hide file tree
Showing 2 changed files with 37 additions and 14 deletions.
50 changes: 36 additions & 14 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,6 @@ name: Release

on:
workflow_dispatch:
inputs:
packageVersion:
description: 'Package version'
required: true

env:
REGISTRY: ghcr.io
Expand All @@ -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:
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand All @@ -129,7 +151,7 @@ jobs:

steps:
- uses: actions/checkout@v3

- name: Log in to the Container registry
uses: docker/login-action@v2
with:
Expand All @@ -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 }}
1 change: 1 addition & 0 deletions version.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
4.3.2

0 comments on commit 5cb2fe4

Please sign in to comment.