-
Notifications
You must be signed in to change notification settings - Fork 0
65 lines (63 loc) · 2.13 KB
/
release.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
62
63
64
65
name: NuGet Release
on:
push:
tags:
- '*.*.*'
- '*.*.*-*'
jobs:
publish:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: 6.0.100-preview.2.21155.3
- name: Build
run: dotnet build -c Release --output ImprovedConsole/Artifacts
- uses: actions/create-release@v1
id: create_release
env:
GITHUB_TOKEN: ${{ secrets.ACCOUNT_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
- name: Archive files
run: |
cd ImprovedConsole/Artifacts
zip -r build.zip *
- name: Publish artifacts to release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.ACCOUNT_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ImprovedConsole/Artifacts/build.zip
asset_name: build.zip
asset_content_type: application/zip
nuget:
needs: publish
runs-on: ubuntu-latest
timeout-minutes: 5
steps:
- name: Checkout
uses: actions/checkout@v2
- name: Setup .NET Core SDK
uses: actions/[email protected]
with:
dotnet-version: 6.0.100-preview.2.21155.3
- name: Replace package versions
run: echo "$(echo "`cat ./ImprovedConsole/ImprovedConsole.csproj`" | perl -pe 's/<PackageVersion>(.*)<\/PackageVersion>/<PackageVersion>'${GITHUB_REF##*/}'<\/PackageVersion>/g')" > ./ImprovedConsole/ImprovedConsole.csproj
- name: Build
run: dotnet build -c Release
- name: Test
run: dotnet test -c Release --no-build
- name: Pack nugets
run: dotnet pack -c Release --no-build --output .
- name: Push to NuGet
uses: alirezanet/[email protected]
with:
PROJECT_FILE_PATH: ./ImprovedConsole/ImprovedConsole.csproj
VERSION_REGEX: <PackageVersion>(.*)<\/PackageVersion>
NUGET_KEY: ${{secrets.NUGET_API_KEY}}