-
Notifications
You must be signed in to change notification settings - Fork 18
102 lines (86 loc) · 3.51 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
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
name: Release
on:
release:
branches:
- master
types: [published]
env:
VERBOSITY: 'Normal'
CONFIGURATION: 'Release'
ACTIONS_ALLOW_UNSECURE_COMMANDS: 'true'
jobs:
Release:
name: Release Build TinyCLR
runs-on: [windows-latest]
strategy:
matrix:
vs-version: [16.6]
steps:
- name: Checkout
uses: actions/checkout@v1
- name: Extract build information into variables
id: info
run: |
echo "##[set-output name=version;]$(echo $env:GITHUB_REF.Replace('refs/tags/v',''))"
echo "##[set-output name=build;]$(echo $(git rev-list --count HEAD))"
echo "##[set-output name=copyright;]$(echo © $(date -u +%Y) Bytewizer. All rights reserved.)"
- name: Show build information
run: |
echo build=${{ steps.info.outputs.build }}
echo copyright=${{ steps.info.outputs.copyright }}
- name: Show release event information
run: |
echo "release.name = ${{ github.event.release.name }}"
echo "release.body = ${{ github.event.release.body }}"
echo "release.upload_url = ${{ github.event.release.upload_url }}"
echo "release.html_url = ${{ github.event.release.html_url }}"
echo "release.tag_name = ${{ github.event.release.tag_name }}"
echo "release.draft = ${{ github.event.release.draft }}"
echo "release.prerelease = ${{ github.event.release.prerelease }}"
- name: Setup msbuild
uses: microsoft/setup-msbuild@v1.0.0
with:
vs-version: ${{ matrix.vs-version }}
- name: Restore project
working-directory: src
run: >-
msbuild -t:restore -verbosity:${env:VERBOSITY}
- name: Release Build and pack libraries
working-directory: src
run: >-
msbuild -t:pack -verbosity:${env:VERBOSITY}
-p:PackageOutputPath=\builds\artifacts
-p:BuildNumber="${{ steps.info.outputs.build }}"
-p:Copyright="${{ steps.info.outputs.copyright }}"
-p:VersionPrefix="${{ steps.info.outputs.version }}"
-p:PackageVersion="${{ steps.info.outputs.version }}"
-p:Configuration=${env:CONFIGURATION}
-p:ContinuousIntegrationBuild=true
-p:Deterministic=true
- name: Upload release artifacts
uses: actions/upload-artifact@v2
with:
name: Release Packages
path: \builds\artifacts
- name: Create release asset
run: Compress-Archive -DestinationPath \builds\nuget-packages.zip -Path \builds\artifacts\*.*nupkg
- name: Upload release asset
uses: actions/upload-release-asset@v1.0.1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ github.event.release.upload_url }}
asset_path: \builds\nuget-packages.zip
asset_name: Nuget packages (zip)
asset_content_type: application/zip
- name: Setup nuget
uses: nuget/setup-nuget@v1
with:
nuget-version: 'latest'
- name: Publish package to github.com
run: |
nuget sources add -name github.com -source "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" -username ${{ github.actor }} -password ${{secrets.PACKAGE_API_KEY}}
nuget push \builds\artifacts\**\*.nupkg -source github.com -apikey ${{secrets.PACKAGE_API_KEY}} -skipduplicate
- name: Publish package to nuget.org
run: |
nuget push \builds\artifacts\**\*.nupkg -source nuget.org -apikey ${{secrets.NUGET_API_KEY}} -skipduplicate