Repository navigation
112 lines (107 loc) · 3.99 KB
/
Copy pathdotnet.yml
File metadata and controls
112 lines (107 loc) · 3.99 KB
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
name: .NET
on:
push:
branches: [ main ]
tags:
- 'v*'
pull_request:
branches: [ main ]
env:
# Stop wasting time caching packages
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: true
# Disable sending usage data to Microsoft
DOTNET_CLI_TELEMETRY_OPTOUT: true
# Project name to pack and publish
PROJECT_NAME: RollCallBot
# GitHub Packages Feed settings
GITHUB_FEED: https://nuget.pkg.github.com/RollCallBot/
GITHUB_USER: dsheehan
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# Official NuGet Feed settings
NUGET_FEED: https://api.nuget.org/v3/index.json
NUGET_KEY: ${{ secrets.NUGET_KEY }}
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
fetch-depth: 0
- name: On Version Tag
#if: startsWith(github.ref, 'refs/tags/v')
id: onversion
run: |
echo ::set-output name=VERSION::${GITHUB_REF/refs\/tags\/v/}
echo Version $VERSION, ${GITHUB_REF/refs\/tags\/v/}
echo ::set-output name=SOURCE_TAG::${GITHUB_REF#refs/tags/}
echo SOURCE_TAG $SOURCE_TAG, ${GITHUB_REF#refs/tags/}
echo ::set-output name=IS_RELEASE::${{startsWith(github.ref, 'refs/tags/v')}}
echo IS_RELEASE $IS_RELEASE, ${{startsWith(github.ref, 'refs/tags/v')}}
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 5.0.101
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build -c Release --no-restore
- name: Test
run: dotnet test -c Release --no-build --verbosity normal
- name: Pack
id: pack
run: dotnet pack -v normal -c Release --no-restore --include-symbols --include-source src/$PROJECT_NAME.*proj
- name: Publish
run: dotnet publish -c Release --no-build --no-restore --self-contained true
- name: Upload nupkg
uses: actions/upload-artifact@v2
with:
name: ${{ env.PROJECT_NAME }}_nupkg
path: ./src/bin/Release/*.nupkg
- name: Upload exe
uses: actions/upload-artifact@v2
with:
name: ${{ env.PROJECT_NAME }}_exe
path: ./src/bin/Release/net5.0/publish/*
- name: Push to GitHub Packages
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: dsheehan/rollcallbot/rollcallbot
tag_with_sha: true
add_git_labels: true
path: /home/runner/work/RollCallBot/RollCallBot/
tags: unstable
- name: Push latest
if: "startsWith(github.ref, 'refs/tags/v')"
uses: docker/build-push-action@v1
with:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
registry: docker.pkg.github.com
repository: dsheehan/rollcallbot/rollcallbot
path: /home/runner/work/RollCallBot/RollCallBot/
tags: latest,${{ steps.onversion.outputs.VERSION }}
- name: Create Release
if: "startsWith(github.ref, 'refs/tags/v')"
id: create_release
uses: actions/create-release@v1
#env:
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: v${{ steps.onversion.outputs.VERSION }}
release_name: Release v${{ steps.onversion.outputs.VERSION }}
draft: false
prerelease: true
- name: Upload Release Asset
if: "startsWith(github.ref, 'refs/tags/v')"
id: upload-release-asset
uses: actions/upload-release-asset@v1
#env:
#GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./src/bin/Release/*.nupkg
asset_name: ${{ env.PROJECT_NAME }}_nupkg
asset_content_type: application/zip