-
Notifications
You must be signed in to change notification settings - Fork 1
61 lines (51 loc) · 1.95 KB
/
basic-repos.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
name: Basic Repos
on:
push:
branches:
- main
pull_request:
branches:
- main
release:
types:
- created
jobs:
Build_Test:
runs-on: ubuntu-latest
env:
package_name: BasicRepos
project_path: src/BasicRepos.csproj
test_project_path: tests/BasicRepos.Test.csproj
steps:
- name: checkout
uses: actions/[email protected]
- name: Add Package source
run: dotnet nuget add source https://nuget.pkg.github.com/astro-panda/index.json --name github --username "${{ github.repository_owner }}" --password "${{ secrets.GITHUB_TOKEN }}" --store-password-in-clear-text
- name: Restore ${{ env.package_name }}
run: |-
dotnet restore ${{ env.project_path }}
- name: Build ${{ env.package_name }}
run: |-
dotnet build --no-restore ${{ env.project_path }} -c Release
- name: Test ${{ env.package_name }}
if: ${{ env.test_project_path }}
run: |-
dotnet test ${{ env.test_project_path }} --logger trx --results-directory "${{ runner.temp }}"
- name: Test ${{ env.package_name }}
if: always()
uses: NasAmin/[email protected]
with:
TRX_PATH: "${{ runner.temp }}"
REPO_TOKEN: "${{ secrets.GITHUB_TOKEN }}"
- name: Pack ${{ env.package_name }}
if: github.event_name == 'release'
run: |-
dotnet pack ${{ env.project_path }} -p:Version=${{ github.ref_name }} --output "${{ runner.temp }}"
- name: Publish ${{ env.package_name }} to GitHub Packages
if: github.event_name == 'release'
run: |-
dotnet nuget push ${{ runner.temp }}/*.nupkg -s github
- name: Publish ${{ env.package_name }} to NuGet
if: github.event_name == 'release' && always()
run: |-
dotnet nuget push ${{ runner.temp }}/*.nupkg -k ${{ secrets.NUGET_PUBLIC_API_KEY }} -s https://api.nuget.org/v3/index.json