Skip to content

Commit 4cbf725

Browse files
committed
Added nuget config with read only access to github package registry
1 parent f99df8a commit 4cbf725

File tree

2 files changed

+78
-0
lines changed

2 files changed

+78
-0
lines changed

.github/workflows/RELEASE.yml

Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: RELEASE
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
- edited
8+
9+
env:
10+
VERSION: 0.0.0
11+
BRANCH: ''
12+
13+
jobs:
14+
build:
15+
name: Build and verify library
16+
runs-on: ubuntu-latest
17+
steps:
18+
- uses: actions/checkout@v2
19+
with:
20+
fetch-depth: 0 # avoid shallow clone so nbgv can do its work.
21+
- uses: dotnet/nbgv@master
22+
with:
23+
setAllVars: true
24+
- name: Setting VERSION and BRANCH env
25+
run: |
26+
echo "::set-env name=VERSION::$NBGV_NuGetPackageVersion"
27+
echo "::set-env name=BRANCH::$(echo ${GITHUB_REF#refs/heads/} | sed 's/\//_/g')"
28+
- name: Update tokens in project files
29+
uses: cschleiden/replace-tokens@v1
30+
with:
31+
files: '["*.csproj", "**/*.csproj"]'
32+
- uses: actions/setup-dotnet@v1
33+
with:
34+
dotnet-version: '3.1.202'
35+
source-url: https://api.nuget.org/v3/index.json
36+
env:
37+
NUGET_AUTH_TOKEN: ${{secrets.NUGET_KEY}}
38+
- name: Building library
39+
run: |
40+
dotnet restore src
41+
dotnet build src/bunit.core/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
42+
dotnet build src/bunit.web/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
43+
dotnet build src/bunit.xunit/ -c Release --no-restore -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
44+
dotnet build src/bunit.testassets/ -c Release --no-restore
45+
- name: Running unit tests
46+
run: |
47+
dotnet test src/bunit.core.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
48+
dotnet test src/bunit.web.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
49+
dotnet test src/bunit.xunit.tests/ -c Release --no-restore --verbosity normal /nowarn:CS1591
50+
- name: Creating library package
51+
run: |
52+
dotnet pack src/bunit.core/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
53+
dotnet pack src/bunit.web/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
54+
dotnet pack src/bunit.xunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
55+
dotnet pack src/bunit/ -c Release -o ${GITHUB_WORKSPACE}/packages -p:RepositoryBranch=$BRANCH -p:ContinuousIntegrationBuild=true -p:DeterministicSourcePaths=true
56+
- name: Buidling template package
57+
run: dotnet pack src/bunit.template/ -c Release -o ${GITHUB_WORKSPACE}/packages
58+
- name: Verifying template
59+
run: |
60+
dotnet new --install ${GITHUB_WORKSPACE}/packages/bunit.template.$VERSION.nupkg
61+
dotnet new bunit --no-restore -o ${GITHUB_WORKSPACE}/Test
62+
dotnet restore ${GITHUB_WORKSPACE}/Test/Test.csproj --source ${GITHUB_WORKSPACE}/packages
63+
dotnet test ${GITHUB_WORKSPACE}/Test
64+
- name: Push packages to GitHub Packages
65+
run: dotnet nuget push ${GITHUB_WORKSPACE}/packages/'*.nupkg' --skip-duplicate

nuget.config

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?xml version="1.0" encoding="utf-8"?>
2+
<configuration>
3+
<packageSources>
4+
<clear />
5+
<add key="github" value="https://nuget.pkg.github.com/egil/index.json" />
6+
</packageSources>
7+
<packageSourceCredentials>
8+
<github>
9+
<add key="Username" value="egil" />
10+
<add key="ClearTextPassword" value="1a419fdf4dba34c3ee2b659c9e5fa41a25273e09" />
11+
</github>
12+
</packageSourceCredentials>
13+
</configuration>

0 commit comments

Comments
 (0)