Merge pull request #156 from microsoft/vpl/python-test #129
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- release/prod/* | |
jobs: | |
# This is the release job, integrating work from windows + linux + mac job | |
# see https://stackoverflow.com/questions/57498605/github-actions-share-workspace-artifacts-between-jobs | |
release: | |
# This integrates the artefacts from the other jobs | |
needs: | |
- linux | |
- windows | |
- mac | |
runs-on: ubuntu-latest | |
steps: | |
# We do not need the source code but we need git for tags & release | |
- uses: actions/checkout@v2 | |
# Retrieve assets | |
- uses: actions/download-artifact@master | |
with: | |
name: linux-assets | |
path: linux-assets | |
- uses: actions/download-artifact@master | |
with: | |
name: windows-assets | |
path: windows-assets | |
- uses: actions/download-artifact@master | |
with: | |
name: mac-assets | |
path: mac-assets | |
# Validate asset content | |
- name: Assets content | |
run: | | |
ls -l linux-assets | |
ls -l linux-assets/bin | |
ls -l windows-assets | |
ls -l windows-assets/bin | |
ls -l mac-assets | |
ls -l mac-assets/bin | |
# Zip assets | |
- name: Mkdir final assets | |
run: mkdir final-assets | |
- name: Zip Linux executable | |
run: | | |
cd linux-assets/bin | |
tar -czvf ../../final-assets/delta-kusto-linux.tar.gz * | |
- name: Zip Mac executable | |
run: | | |
cd mac-assets/bin | |
tar -czvf ../../final-assets/delta-kusto-mac.tar.gz * | |
- name: Zip Windows executable | |
run: | | |
cd windows-assets/bin | |
tar -czvf ../../final-assets/delta-kusto-windows.tar.gz * | |
# Validate final assets | |
- name: Final assets content | |
run: ls -l final-assets | |
# See https://cli.github.com/manual/gh_auth | |
- name: Authentication gh CLI | |
run: | | |
echo "${{ secrets.GITHUB_TOKEN }}" | gh auth login --with-token | |
# See https://cli.github.com/manual/gh_release | |
- name: Create full version release | |
run: | | |
# Retrieve content of full-version from artefact | |
fullVersion=$(cat linux-assets/full-version.txt) | |
# Create the release | |
gh release create -d $fullVersion final-assets/* | |
# Linux job, builds the Linux asset | |
linux: | |
runs-on: ubuntu-latest | |
env: | |
dotnetOs: linux-x64 | |
assetsName: linux-assets | |
assetSuffix: linux | |
execName: delta-kusto | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.x | |
- name: Patch version | |
id: patch-version | |
run: python3 deployment/patch-version.py code/delta-kusto/delta-kusto.csproj ${{ github.run_number }} | |
- name: Output full version | |
shell: bash | |
run: | | |
echo "Full version: ${{ steps.patch-version.outputs.full-version }}" | |
- name: Create artefact directory | |
shell: bash | |
run: | | |
mkdir $assetsName | |
mkdir $assetsName/bin | |
mkdir bin | |
# See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-restore | |
- name: Install dependencies | |
shell: bash | |
run: dotnet restore code | |
# See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-build | |
- name: Build | |
shell: bash | |
run: dotnet build code --configuration Release --no-restore | |
# See https://github.com/dotnet/designs/blob/main/accepted/2020/single-file/design.md#user-experience | |
# & https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file | |
# & https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish | |
- name: Build single file executable | |
shell: bash | |
run: | | |
dotnet publish code/delta-kusto -c release -r $dotnetOs \ | |
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true \ | |
-p:PublishTrimmed=true -p:PublishReadyToRun=true \ | |
-o bin | |
- name: Copy executable to assets | |
shell: bash | |
run: cp bin/$execName $assetsName/bin/$execName | |
# Output variables can't be shared accross jobs, so we push it to artefacts | |
- name: Push full version to file | |
shell: bash | |
run: echo ${{ steps.patch-version.outputs.full-version }} >> $assetsName/full-version.txt | |
# Push archive + version to a sharable artefact | |
# See https://stackoverflow.com/questions/57498605/github-actions-share-workspace-artifacts-between-jobs | |
- uses: actions/upload-artifact@master | |
with: | |
name: ${{ env.assetsName }} | |
path: ${{ env.assetsName }} | |
# Mac job, builds the Mac-OS asset | |
mac: | |
runs-on: macos-latest | |
env: | |
dotnetOs: osx-x64 | |
assetsName: mac-assets | |
assetSuffix: mac | |
execName: delta-kusto | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.x | |
- name: Patch version | |
id: patch-version | |
run: python3 deployment/patch-version.py code/delta-kusto/delta-kusto.csproj ${{ github.run_number }} | |
- name: Output full version | |
shell: bash | |
run: | | |
echo "Full version: ${{ steps.patch-version.outputs.full-version }}" | |
- name: Create artefact directory | |
shell: bash | |
run: | | |
mkdir $assetsName | |
mkdir $assetsName/bin | |
mkdir bin | |
# See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-restore | |
- name: Install dependencies | |
shell: bash | |
run: dotnet restore code | |
# See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-build | |
- name: Build | |
shell: bash | |
run: dotnet build code --configuration Release --no-restore | |
# See https://github.com/dotnet/designs/blob/main/accepted/2020/single-file/design.md#user-experience | |
# & https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file | |
# & https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish | |
- name: Build single file executable | |
shell: bash | |
run: | | |
dotnet publish code/delta-kusto -c release -r $dotnetOs \ | |
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true \ | |
-p:PublishTrimmed=true -p:PublishReadyToRun=true \ | |
-o bin | |
- name: Copy executable to assets | |
shell: bash | |
run: cp bin/$execName $assetsName/bin/$execName | |
# Output variables can't be shared accross jobs, so we push it to artefacts | |
- name: Push full version to file | |
shell: bash | |
run: echo ${{ steps.patch-version.outputs.full-version }} >> $assetsName/full-version.txt | |
# Push archive + version to a sharable artefact | |
# See https://stackoverflow.com/questions/57498605/github-actions-share-workspace-artifacts-between-jobs | |
- uses: actions/upload-artifact@master | |
with: | |
name: ${{ env.assetsName }} | |
path: ${{ env.assetsName }} | |
# Windows job, builds the Windows asset | |
windows: | |
runs-on: windows-latest | |
env: | |
dotnetOs: win-x64 | |
assetsName: windows-assets | |
assetSuffix: windows | |
execName: delta-kusto.exe | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET Core | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 7.x | |
- name: Patch version | |
id: patch-version | |
run: python3 deployment/patch-version.py code/delta-kusto/delta-kusto.csproj ${{ github.run_number }} | |
- name: Output full version | |
shell: bash | |
run: | | |
echo "Full version: ${{ steps.patch-version.outputs.full-version }}" | |
- name: Create artefact directory | |
shell: bash | |
run: | | |
mkdir $assetsName | |
mkdir $assetsName/bin | |
mkdir bin | |
# See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-restore | |
- name: Install dependencies | |
shell: bash | |
run: dotnet restore code | |
# See https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-build | |
- name: Build | |
shell: bash | |
run: dotnet build code --configuration Release --no-restore | |
# See https://github.com/dotnet/designs/blob/main/accepted/2020/single-file/design.md#user-experience | |
# & https://docs.microsoft.com/en-us/dotnet/core/deploying/single-file | |
# & https://docs.microsoft.com/en-us/dotnet/core/tools/dotnet-publish | |
- name: Build single file executable | |
shell: bash | |
run: | | |
dotnet publish code/delta-kusto -c release -r $dotnetOs \ | |
-p:PublishSingleFile=true -p:IncludeNativeLibrariesForSelfExtract=true \ | |
-p:PublishTrimmed=true -p:PublishReadyToRun=true \ | |
-o bin | |
- name: Copy executable to assets | |
shell: bash | |
run: cp bin/$execName $assetsName/bin/$execName | |
# Output variables can't be shared accross jobs, so we push it to artefacts | |
- name: Push full version to file | |
shell: bash | |
run: echo ${{ steps.patch-version.outputs.full-version }} >> $assetsName/full-version.txt | |
# Push archive + version to a sharable artefact | |
# See https://stackoverflow.com/questions/57498605/github-actions-share-workspace-artifacts-between-jobs | |
- uses: actions/upload-artifact@master | |
with: | |
name: ${{ env.assetsName }} | |
path: ${{ env.assetsName }} |