Skip to content

Commit

Permalink
Set version during github build
Browse files Browse the repository at this point in the history
  • Loading branch information
JustAman62 committed Aug 26, 2024
1 parent 4132a24 commit 3eb332c
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 3 deletions.
9 changes: 9 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,11 @@ jobs:
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0

- uses: dotnet/nbgv@master
id: nbgv

- name: Log in to the Container registry
uses: docker/login-action@v3
Expand All @@ -38,6 +43,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
build-args:
VERSION=${{ steps.nbgv.outputs.AssemblyInformationalVersion }}
push: true
tags: 'ghcr.io/brownknight/grid-battle:latest'
cache-from: type=gha
Expand All @@ -48,6 +55,8 @@ jobs:
uses: docker/build-push-action@v6
with:
context: .
build-args:
VERSION=${{ steps.nbgv.outputs.AssemblyInformationalVersion }}
file: "./server/GridBattle.Data.Importer/Dockerfile"
push: true
tags: 'ghcr.io/brownknight/grid-battle-importer:latest'
Expand Down
4 changes: 2 additions & 2 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -3,14 +3,14 @@ FROM --platform=$BUILDPLATFORM mcr.microsoft.com/dotnet/sdk:8.0 AS build-server
WORKDIR /source

COPY ./server/Directory.* .
COPY ./server/version.json .
COPY ./server/GridBattle.Data/GridBattle.Data.csproj GridBattle.Data/GridBattle.Data.csproj
COPY ./server/GridBattle.Api/GridBattle.Api.csproj GridBattle.Api/GridBattle.Api.csproj
RUN dotnet restore GridBattle.Api/GridBattle.Api.csproj

COPY ./server/GridBattle.Data GridBattle.Data
COPY ./server/GridBattle.Api GridBattle.Api
RUN dotnet publish GridBattle.Api/GridBattle.Api.csproj -c Release -o publish
ARG VERSION=0.0.1
RUN dotnet publish GridBattle.Api/GridBattle.Api.csproj -c Release -o publish /p:Version=$VERSION

FROM node:20 AS build-ui

Expand Down
3 changes: 2 additions & 1 deletion server/GridBattle.Data.Importer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,8 @@ RUN dotnet restore GridBattle.Data.Importer/GridBattle.Data.Importer.csproj

COPY ./server/GridBattle.Data GridBattle.Data
COPY ./server/GridBattle.Data.Importer GridBattle.Data.Importer
RUN dotnet publish GridBattle.Data.Importer/GridBattle.Data.Importer.csproj -c Release -o publish
ARG VERSION=0.0.1
RUN dotnet publish GridBattle.Data.Importer/GridBattle.Data.Importer.csproj -c Release -o publish /p:Version=$VERSION

FROM mcr.microsoft.com/dotnet/aspnet:8.0

Expand Down
File renamed without changes.

0 comments on commit 3eb332c

Please sign in to comment.