Skip to content
name: Build and release runtime
on:
pull_request:
workflow_dispatch:
inputs:
tag:
type: string
description: Tagged version to build
required: false
commit:
type: string
required: false
description: SHA of the commit to build (no release will be produced)
push:
tags:
- 'v*-*'
jobs:
env-variables:
outputs:
runtime-version: ${{ steps.set-env.outputs.runtime-version }}
runtime-patch: ${{ steps.set-env.outputs.runtime-patch }}
code-version: ${{ steps.find-ref.outputs.ref-to-checkout }}
runs-on: ubuntu-latest
steps:
- name: Find version to checkout
id: find-ref
run: |
[ -n "${{github.event.inputs.tag}}" ] && TAG="refs/tags/${{github.event.inputs.tag}}"
[ -n "${{github.event.inputs.commit}}" ] && TAG="${{github.event.inputs.commit}}"
[ -z "$TAG" ] && [ -n "${{github.ref}}" ] && TAG="${{github.ref}}"
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\/tags\/v(.*)-(.*)"
if [[ "$VERSION_CHECKOUT" =~ $regex ]]
then
RUNTIME_PATCH=${BASH_REMATCH[2]}
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
echo code-version=${{steps.find-ref.outputs.ref-to-checkout}} >> $GITHUB_OUTPUT
build-linux-release:
runs-on: ubuntu-latest
needs: env-variables
container:
image: mcr.microsoft.com/dotnet-buildtools/prereqs:centos-stream8
steps:
- name: Check out runtime source code
uses: actions/checkout@v4
with:
ref: ${{needs.env-variables.outputs.code-version}}
- name: Build
uses: ./.github/actions/build-linux
with:
version-runtime: ${{needs.env-variables.outputs.runtime-version}}
version-patch: ${{needs.env-variables.outputs.runtime-patch}}
build-configuration: Release
output-artifact-name: 'linux-runtime-release'
build-windows-release:
runs-on: windows-latest
needs: env-variables
steps:
- name: Check out runtime source code
uses: actions/checkout@v4
with:
ref: ${{needs.env-variables.outputs.code-version}}
- name: Build
uses: ./.github/actions/build-windows
with:
version-runtime: ${{needs.env-variables.outputs.runtime-version}}
version-patch: ${{needs.env-variables.outputs.runtime-patch}}
build-configuration: Release
output-artifact-name: 'windows-runtime-release'
mscordaccore-artifact-name: 'mscordaccore-release'
package-and-release:
runs-on: ubuntu-latest
if: needs.env-variables.outputs.runtime-patch != 'dev'
env:
RUNTIME_VERSION: ${{needs.env-variables.outputs.runtime-version}}
RUNTIME_PATCH: ${{needs.env-variables.outputs.runtime-patch}}
needs:
- env-variables
- build-linux-release
- build-windows-release
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-release
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