Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix build workflow #108895

Closed
wants to merge 9 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
138 changes: 138 additions & 0 deletions .github/workflows/build_and_release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,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
10 changes: 10 additions & 0 deletions .github/workflows/manual_build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
name: Manual build
on: [workflow_dispatch]
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Clone repository
uses: actions/checkout@v2
- name: Build
run: git status