-
Notifications
You must be signed in to change notification settings - Fork 4.9k
138 lines (132 loc) · 5.61 KB
/
build_and_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
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
name: Build and release runtime
on:
pull_request:
workflow_dispatch:
inputs:
tag:
type: string
description: Tagged version to build
push:
tags:
- 'v*-*'
jobs:
env-variables:
outputs:
runtime-version: ${{ steps.set-env.outputs.runtime-version }}
runtime-patch: ${{ steps.set-env.outputs.runtime-patch }}
runs-on: ubuntu-latest
steps:
- name: Find version to checkout
id: find-ref
run: |
[ -n "${{github.event.inputs.tag}}" ] && TAG="${{github.event.inputs.tag}}"
[ -z "$TAG"] && [ -n "${{github.ref}}" ] && TAG="${{github.ref}}"
echo TAG=$TAG
echo ref-to-checkout=${TAG} >> $GITHUB_OUTPUT
- name: Check out runtime source code
uses: actions/checkout@v4
with:
ref: ${{steps.find-ref.outputs.ref-to-checkout}}
- name: Extract runtime version (from code) and patch (from github ref)
id: set-env
run: |
RUNTIME_VERSION=$(sed -n 's#.*<ProductVersion>\(.*\)</ProductVersion>#\1#p' < eng/Versions.props)
VERSION_CHECKOUT=${{steps.find-ref.outputs.ref-to-checkout}}
regex="(refs\/.*\/)*v(.*)-(.*)"
if [[ "$VERSION_CHECKOUT" =~ $regex ]]
then
RUNTIME_PATCH=${BASH_REMATCH[3]}
else
RUNTIME_PATCH=dev
fi
echo RUNTIME_VERSION=${RUNTIME_VERSION}
echo RUNTIME_PATCH=${RUNTIME_PATCH}
echo runtime-version=${RUNTIME_VERSION} >> $GITHUB_OUTPUT
echo runtime-patch=${RUNTIME_PATCH} >> $GITHUB_OUTPUT
build-linux:
runs-on: ubuntu-latest
needs: env-variables
env:
RUNTIME_VERSION: ${{needs.env-variables.outputs.runtime-version}}
RUNTIME_PATCH: ${{needs.env-variables.outputs.runtime-patch}}
container:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8
steps:
- name: Check out runtime source code
uses: actions/checkout@v4
with:
ref: ${{github.rev}}
- name: Build for Linux
run: ./build.sh -c Release /p:VersionSuffix=${{env.RUNTIME_PATCH}} /p:StabilizePackageVersion=false /p:OfficialBuildId=20201010.1 /p:NativeOptimizationDataSupported=false
- name : Download dotnet install scripts
run: wget https://dotnet.microsoft.com/download/dotnet/scripts/v1/dotnet-install.sh
- name: Retrieve official ASP.Net Core runtime
run: |
chmod u+x ./dotnet-install.sh
mkdir -p artifacts/packages/Release/Shipping/aspnetcore-runtime
./dotnet-install.sh --runtime aspnetcore --version ${{env.RUNTIME_VERSION}} --os linux --install-dir artifacts/packages/Release/Shipping/aspnetcore-runtime
- name: Extract generated runtime artifact, add crossgen, symbols, and AspNetCore runtime
run: |
FULL_VERSION=${{env.RUNTIME_VERSION}}-${{env.RUNTIME_PATCH}}
cd artifacts/packages/Release/Shipping
mkdir -p dotnet-runtime
cd dotnet-runtime
tar -xzvf ../dotnet-runtime-${FULL_VERSION}-linux-x64.tar.gz
cd shared/Microsoft.NETCore.App/${FULL_VERSION}
tar -xzvf ../../../../dotnet-crossgen2-${FULL_VERSION}-linux-x64.tar.gz
tar -xzvf ../../../../dotnet-nethost-symbols-linux-x64-${FULL_VERSION}.tar.gz
cd ../../../..
cp -R aspnetcore-runtime/shared/Microsoft.AspNetCore.App dotnet-runtime/shared/Microsoft.AspNetCore.App
mv dotnet-runtime/shared/Microsoft.AspNetCore.App/${{env.RUNTIME_VERSION}} dotnet-runtime/shared/Microsoft.AspNetCore.App/${FULL_VERSION}
sed -i "s/${{env.RUNTIME_VERSION}}/${FULL_VERSION}/g" dotnet-runtime/shared/Microsoft.AspNetCore.App/${FULL_VERSION}/Microsoft.AspNetCore.App.runtimeconfig.json
cd dotnet-runtime
tar -zcvf ../aspnetcore-runtime-${FULL_VERSION}-linux-x64.tar.gz .
- name: Upload runtime artifact
uses: actions/upload-artifact@v4
with:
name: linux-runtime
path: artifacts/packages/Release/Shipping/aspnetcore-runtime-${{env.RUNTIME_VERSION}}-${{env.RUNTIME_PATCH}}-linux-x64.tar.gz
build-windows:
runs-on: windows-latest
steps:
- name: Check out runtime source code
uses: actions/checkout@v4
with:
ref: ${{github.rev}}
- name: Build CLR for Windows
run: .\build.cmd clr -c Release /p:OfficialBuildId=20201010.1
- name: Upload mscordaccore artifact
uses: actions/upload-artifact@v4
with:
name: mscordaccore.dll
path: artifacts/bin/coreclr/Linux.x64.Release/x64/mscordaccore.dll
package-and-release:
runs-on: ubuntu-latest
if: startsWith(github.ref, 'refs/tags/')
env:
RUNTIME_VERSION: ${{needs.env-variables.outputs.runtime-version}}
RUNTIME_PATCH: ${{needs.env-variables.outputs.runtime-patch}}
needs:
- env-variables
- build-linux
- build-windows
steps:
- name: Download .Net runtime artifact
uses: actions/download-artifact@v4
with:
name: linux-runtime
path: .
- name: Download mscordaccore artifact
uses: actions/download-artifact@v4
with:
name: mscordaccore.dll
path: .
- name: Create release
uses: softprops/action-gh-release@v2
with:
name: v${{env.RUNTIME_VERSION}}-${{env.RUNTIME_PATCH}}
body: Release of custom runtime v${{env.RUNTIME_VERSION}}-${{env.RUNTIME_PATCH}}
files: |
aspnetcore-runtime-${{env.RUNTIME_VERSION}}-${{env.RUNTIME_PATCH}}-linux-x64.tar.gz
mscordaccore.dll
draft: true