-
Notifications
You must be signed in to change notification settings - Fork 13
140 lines (114 loc) · 4.16 KB
/
build.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
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
name: Build Yarn Spinner
on:
push:
branches: '*'
tags: '*'
pull_request:
branches: '*'
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v1
with:
dotnet-version: 6.0.x
- name: Fetch all commits
run: git fetch --unshallow
- uses: gittools/actions/gitversion/[email protected]
name: Install GitVersion
with:
versionSpec: '5.x'
- uses: gittools/actions/gitversion/[email protected]
name: Execute GitVersion
id: gitversion # step id used as reference for output values
with:
updateAssemblyInfo: true
- name: Print version information
run: |
echo "Major: ${{ steps.gitversion.outputs.major }}"
echo "Minor: ${{ steps.gitversion.outputs.minor }}"
echo "Patch: ${{ steps.gitversion.outputs.patch }}"
echo "MajorMinorPatch: ${{ steps.gitversion.outputs.majorMinorPatch }}"
echo "SemVer: ${{ steps.gitversion.outputs.semVer }}"
- name: Restore dependencies
run: dotnet restore
- name: Build
run: dotnet build --no-restore --configuration Release
- name: Test
run: dotnet test --no-build --configuration Release --verbosity normal
- name: Package for Windows
run: dotnet publish -r win-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishTrimmed=True
- uses: actions/upload-artifact@v2
name: Upload Windows build
with:
name: ysc-win
path: src/YarnSpinner.Console/bin/Release/netcoreapp6.0/win-x64/publish/ysc.exe
- name: Package for macOS
run: |
dotnet publish -r osx-x64 -c Release --self-contained true -p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true -p:PublishTrimmed=True
tar -cvf ysc-osx.tar --directory=src/YarnSpinner.Console/bin/Release/netcoreapp6.0/osx-x64/publish/ .
- uses: actions/upload-artifact@v2
name: Upload macOS build
with:
name: ysc-osx
path: ysc-osx.tar
outputs:
builtVersion: ${{ steps.gitversion.outputs.fullSemVer }}-${{ steps.gitversion.outputs.shortSha }}
release:
needs: build
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/v')
steps:
- uses: actions/checkout@v2
- uses: actions/download-artifact@v2
name: Download artifacts
- name: Extract release notes
id: extract-release-notes
uses: ffurrer2/extract-release-notes@v1
- name: Read release notes preface
id: release_preface
uses: bluwy/substitute-string-action@v1
with:
_input-file: .github/RELEASE_TEMPLATE.md
_format-key: '{key}'
RELEASE_TAG: ${{ github.ref_name }}
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: ${{ needs.build.outputs.builtVersion }}
draft: true
prerelease: true
body: |
${{ steps.release_preface.outputs.result }}
${{ steps.extract-release-notes.outputs.release_notes }}
- name: Package Windows build
run: |
zip --junk-paths ysc-win.zip ysc-win/ysc.exe
- name: Upload Windows Build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ysc-win.zip
asset_name: ysc-win-${{ needs.build.outputs.builtVersion }}.zip
asset_content_type: application/zip
- name: Package macOS build
run: |
gzip ysc-osx/ysc-osx.tar
- name: Upload macOS Build
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./ysc-osx/ysc-osx.tar.gz
asset_name: ysc-osx-${{ needs.build.outputs.builtVersion }}.tar.gz
asset_content_type: application/gzip