From ae0380ab78747d972dd334854dbcc70f7fe38693 Mon Sep 17 00:00:00 2001 From: Fredi Machado Date: Fri, 22 Sep 2023 17:40:27 +1000 Subject: [PATCH] Add minver versioning --- .github/workflows/admin-api.yml | 17 ++++++++++++++++- Directory.Build.props | 8 ++++++++ NCafe.sln | 10 ++++++++++ 3 files changed, 34 insertions(+), 1 deletion(-) create mode 100644 Directory.Build.props diff --git a/.github/workflows/admin-api.yml b/.github/workflows/admin-api.yml index e5961e1..0adad16 100644 --- a/.github/workflows/admin-api.yml +++ b/.github/workflows/admin-api.yml @@ -12,7 +12,8 @@ env: PROJECT_NAME: NCafe.Admin.Api REGISTRY: ghcr.io IMAGE_NAME: fredimachado/ncafe-admin-api - + MINVERTAGPREFIX: adm- + defaults: run: working-directory: src/Admin/NCafe.Admin.Api @@ -28,12 +29,24 @@ jobs: steps: - uses: actions/checkout@v3 + with: + fetch-depth: 0 - name: Setup .NET uses: actions/setup-dotnet@v3 with: dotnet-version: 7.0.x + - name: Install minver cli + run: dotnet tool install --tool-path ./minver minver-cli --version 4.3.0 + + - name: Calculate version + run: | + MINVERVERSION=$(./minver/minver -p alpha -t ${{ env.MINVERTAGPREFIX }}) + echo "VERSION=$MINVERVERSION" >> "$GITHUB_ENV" + echo "MINVERVERSIONOVERRIDE=$MINVERVERSION" >> "$GITHUB_ENV" + echo "VERSION: $MINVERVERSION" + - name: Restore dependencies run: dotnet restore @@ -58,6 +71,8 @@ jobs: uses: docker/metadata-action@9ec57ed1fcdbf14dcef7dfbe97b2010124a938b7 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}},value=${{ env.VERSION }} - name: Build and push Docker image uses: docker/build-push-action@f2a1d5e99d037542a71f64918e516c093c6f3fc4 diff --git a/Directory.Build.props b/Directory.Build.props new file mode 100644 index 0000000..8d0f2b7 --- /dev/null +++ b/Directory.Build.props @@ -0,0 +1,8 @@ + + + + all + runtime; build; native; contentfiles; analyzers; buildtransitive + + + diff --git a/NCafe.sln b/NCafe.sln index 8ff46d4..a137fce 100644 --- a/NCafe.sln +++ b/NCafe.sln @@ -35,6 +35,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution ProjectSection(SolutionItems) = preProject .editorconfig = .editorconfig .env-local = .env-local + Directory.Build.props = Directory.Build.props infrastructure-compose.yaml = infrastructure-compose.yaml README.md = README.md services-compose.yaml = services-compose.yaml @@ -58,6 +59,14 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "scripts", "scripts", "{A86C scripts\update-nginx = scripts\update-nginx EndProjectSection EndProject +Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{965A2803-CEAE-4A99-A6ED-087A2E30DBC8}" + ProjectSection(SolutionItems) = preProject + .github\workflows\admin-api.yml = .github\workflows\admin-api.yml + .github\workflows\barista-api.yml = .github\workflows\barista-api.yml + .github\workflows\cashier-api.yml = .github\workflows\cashier-api.yml + .github\workflows\deploy_template.yml = .github\workflows\deploy_template.yml + EndProjectSection +EndProject Global GlobalSection(SolutionConfigurationPlatforms) = preSolution Debug|Any CPU = Debug|Any CPU @@ -133,6 +142,7 @@ Global {23A26860-042D-4E27-8D3D-FDAFEF231C42} = {2694AE6D-E1BB-49F4-B8F6-D023610909BC} {25EC5820-391C-43AB-A750-D73346C30897} = {F28F0BC8-4EA1-4980-B721-ED47D569343B} {A86CCFC2-A4C3-489D-8F9E-1E182DF1B4AF} = {38B2A41D-2CD0-48A4-8B0E-8380E6C20FAB} + {965A2803-CEAE-4A99-A6ED-087A2E30DBC8} = {38B2A41D-2CD0-48A4-8B0E-8380E6C20FAB} EndGlobalSection GlobalSection(ExtensibilityGlobals) = postSolution SolutionGuid = {F0136BF1-D5F3-4E83-8D23-E3F43534FBB5}