-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add the way to build & publish the package.
- Loading branch information
1 parent
5dce39f
commit fafb840
Showing
5 changed files
with
91 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
# directories | ||
**/bin/ | ||
**/obj/ | ||
**/out/ | ||
|
||
# files | ||
Dockerfile* | ||
**/*.md | ||
|
||
!README.md |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
on: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Build | ||
run: docker build --target build . | ||
- name: Test | ||
run: docker build --target test . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
on: | ||
release: | ||
types: [released] | ||
jobs: | ||
publish: | ||
runs-on: ubuntu-latest | ||
timeout-minutes: 15 | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v2 | ||
- name: Set VERSION variable from tag | ||
run: echo "VERSION=${GITHUB_REF/refs\/tags\/}" >> $GITHUB_ENV | ||
- name: Build | ||
run: docker build --target build . | ||
- name: Test | ||
run: docker build --target test . | ||
- name: Pack & Publish | ||
run: docker build --target pack-and-push --build-arg PackageVersion=${VERSION} --build-arg NuGetApiKey=${{secrets.NUGET_API_KEY}} . | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
FROM mcr.microsoft.com/dotnet/sdk:6.0 AS build | ||
WORKDIR /source | ||
|
||
# copy csproj and restore as distinct layers | ||
COPY *.sln . | ||
COPY src/StrEnum.Dapper/StrEnum.Dapper.csproj ./src/StrEnum.Dapper/StrEnum.Dapper.csproj | ||
COPY test/StrEnum.Dapper.UnitTests/StrEnum.Dapper.UnitTests.csproj ./test/StrEnum.Dapper.UnitTests/StrEnum.Dapper.UnitTests.csproj | ||
RUN dotnet restore | ||
|
||
# copy everything else and build app | ||
COPY ./ ./ | ||
WORKDIR /source | ||
RUN dotnet build -c release -o /out/package --no-restore /p:maxcpucount=1 | ||
|
||
FROM build as test | ||
RUN dotnet test /p:maxcpucount=1 | ||
|
||
FROM build as pack-and-push | ||
WORKDIR /source | ||
|
||
ARG PackageVersion | ||
ARG NuGetApiKey | ||
|
||
RUN dotnet pack ./src/StrEnum.Dapper/StrEnum.Dapper.csproj -o /out/package -c Release | ||
RUN dotnet nuget push /out/package/StrEnum.Dapper.$PackageVersion.nupkg -k $NuGetApiKey -s https://api.nuget.org/v3/index.json |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters