-
Notifications
You must be signed in to change notification settings - Fork 1
193 lines (167 loc) · 6.1 KB
/
release.yaml
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
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
name: Build and Release
on:
push:
tags:
- "v*"
permissions:
contents: write
jobs:
build:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-latest, windows-latest, macos-latest]
architecture: [x64, arm64]
include:
- os: ubuntu-latest
rid: linux-x64
architecture: x64
- os: ubuntu-latest
rid: linux-arm64
architecture: arm64
- os: windows-latest
rid: win-x64
architecture: x64
- os: windows-latest
rid: win-arm64
architecture: arm64
- os: macos-latest
rid: osx-x64
architecture: x64
- os: macos-latest
rid: osx-arm64
architecture: arm64
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Setup .NET
uses: actions/setup-dotnet@v2
with:
dotnet-version: "8.0.x"
- name: Install dependencies
run: dotnet restore src
- name: Build
run: dotnet build src/Passenger.csproj --configuration Release --runtime ${{ matrix.rid }} --self-contained
- name: Publish
run: dotnet publish src/Passenger.csproj --configuration Release --runtime ${{ matrix.rid }} --self-contained --output ./publish
- name: Zip published files (Linux and macOS)
if: runner.os != 'Windows'
run: |
cd publish
zip -r ../${{ matrix.os }}-${{ matrix.architecture }}-artifact.zip .
shell: bash
- name: Zip published files (Windows)
if: runner.os == 'Windows'
run: |
powershell Compress-Archive -Path publish\* -DestinationPath ${{ matrix.os }}-${{ matrix.architecture }}-artifact.zip
- name: Upload artifact
uses: actions/upload-artifact@v2
with:
name: ${{ matrix.os }}-${{ matrix.architecture }}-artifact
path: ./${{ matrix.os }}-${{ matrix.architecture }}-artifact.zip
release:
runs-on: ubuntu-latest
needs: build
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Download artifacts (Linux x64)
uses: actions/download-artifact@v2
with:
name: ubuntu-latest-x64-artifact
path: ./artifacts
- name: Download artifacts (Linux ARM64)
uses: actions/download-artifact@v2
with:
name: ubuntu-latest-arm64-artifact
path: ./artifacts
- name: Download artifacts (Windows x64)
uses: actions/download-artifact@v2
with:
name: windows-latest-x64-artifact
path: ./artifacts
- name: Download artifacts (Windows ARM64)
uses: actions/download-artifact@v2
with:
name: windows-latest-arm64-artifact
path: ./artifacts
- name: Download artifacts (macOS x64)
uses: actions/download-artifact@v2
with:
name: macos-latest-x64-artifact
path: ./artifacts
- name: Download artifacts (macOS ARM64)
uses: actions/download-artifact@v2
with:
name: macos-latest-arm64-artifact
path: ./artifacts
- name: Determine if Pre-release
id: prerelease_check
run: echo "::set-output name=prerelease::$(echo ${{ github.ref }} | grep -E -q 'v[0-9]+\.[0-9]+\.[0-9]+-[a-zA-Z0-9]+' && echo true || echo false)"
- name: Create GitHub Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
release_name: Release ${{ github.ref }}
draft: false
prerelease: ${{ steps.prerelease_check.outputs.prerelease }}
body: |
### Description
Release for ${{ github.ref }}
- name: Upload Release Asset (Linux x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/ubuntu-latest-x64-artifact.zip
asset_name: linux-x64.zip
asset_content_type: application/zip
- name: Upload Release Asset (Linux ARM64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/ubuntu-latest-arm64-artifact.zip
asset_name: linux-arm64.zip
asset_content_type: application/zip
- name: Upload Release Asset (Windows x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/windows-latest-x64-artifact.zip
asset_name: windows-x64.zip
asset_content_type: application/zip
- name: Upload Release Asset (Windows ARM64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/windows-latest-arm64-artifact.zip
asset_name: windows-arm64.zip
asset_content_type: application/zip
- name: Upload Release Asset (macOS x64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/macos-latest-x64-artifact.zip
asset_name: osx-x64.zip
asset_content_type: application/zip
- name: Upload Release Asset (macOS ARM64)
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./artifacts/macos-latest-arm64-artifact.zip
asset_name: osx-arm64.zip
asset_content_type: application/zip