Skip to content

Merge pull request #230 from fintermobilityas/dependabot/nuget/Avalon… #606

Merge pull request #230 from fintermobilityas/dependabot/nuget/Avalon…

Merge pull request #230 from fintermobilityas/dependabot/nuget/Avalon… #606

Workflow file for this run

name: demoapp
on:
push:
branches:
- develop
- master
env:
GITVERSION_VERSION: 5.12.0
DOTNET_SDK_VERSION: 8.0.403
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1
DOTNET_CLI_TELEMETRY_OPTOUT: 1
SNAPX_LOG_EXCEPTIONS: 1
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: ${{ github.ref_name != 'master' }}
jobs:
setup:
name: Setup
runs-on: ubuntu-latest
outputs:
BUILD_VERSION: ${{ steps.set-build-version.outputs.BUILD_VERSION }}
SNAPX_VERSION: ${{ steps.set-snapx-version.outputs.SNAPX_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Add dotnet tools to environment path
shell: pwsh
run: echo "${HOME}/.dotnet/tools" | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
- id: set-build-version
name: Read current application version
shell: pwsh
run: |
dotnet tool update GitVersion.Tool --global --version ${{ env.GITVERSION_VERSION }}
$BUILD_VERSION = (dotnet gitversion /showVariable NugetVersionv2) | out-string
echo "BUILD_VERSION=$BUILD_VERSION" >> $env:GITHUB_OUTPUT
- id: set-snapx-version
name: Read current snapx version
shell: pwsh
run: |
[xml] $xml_content = Get-Content ".\$GITHUB_WORKSPACE\Directory.Packages.props";
$SNAPX_VERSION = Select-Xml -Xml $xml_content -XPath "//Project/PropertyGroup/SnapxVersion" | Select -Expand Node | Select -Expand "#text"
echo "SNAPX_VERSION=$SNAPX_VERSION" >> $env:GITHUB_OUTPUT
build:
name: Build ${{ matrix.os }}-${{ matrix.rid }}
runs-on: ${{ matrix.os }}
needs: [setup]
strategy:
matrix:
include:
- os: ubuntu-latest
id: demoapp-linux-arm64
rid: linux-arm64
- os: ubuntu-latest
id: demoapp-linux-x64
rid: linux-x64
- os: windows-latest
id: demoapp-win-x86
rid: win-x86
- os: windows-latest
id: demoapp-win-x64
rid: win-x64
env:
BUILD_VERSION: ${{ needs.setup.outputs.BUILD_VERSION }}
SNAPX_VERSION: ${{ needs.setup.outputs.SNAPX_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Setup dotnet ${{ env.DOTNET_SDK_VERSION }}
uses: actions/[email protected]
with:
dotnet-version: "${{ env.DOTNET_SDK_VERSION }}"
- name: Build
shell: pwsh
run: .\build.ps1 -Version ${{ env.BUILD_VERSION }} -Rid ${{ matrix.rid }}
- name: Upload artifacts
if: success()
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.id }}-artifacts
path: ${{ github.workspace }}/.snapx/artifacts/${{ matrix.id }}/${{ matrix.rid }}/${{ env.BUILD_VERSION }}
publish:
if: success()
name: Publish ${{ matrix.rid }}
runs-on: ${{ matrix.os }}
needs: [setup, build]
strategy:
fail-fast: false
matrix:
include:
- os: ubuntu-latest
id: demoapp-linux-arm64
rid: linux-arm64
- os: ubuntu-latest
id: demoapp-linux-x64
rid: linux-x64
- os: windows-latest
id: demoapp-win-x86
rid: win-x86
- os: windows-latest
id: demoapp-win-x64
rid: win-x64
env:
BUILD_VERSION: ${{ needs.setup.outputs.BUILD_VERSION }}
SNAPX_VERSION: ${{ needs.setup.outputs.SNAPX_VERSION }}
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
lfs: true
- name: Setup dotnet ${{ env.DOTNET_SDK_VERSION }}
uses: actions/[email protected]
with:
dotnet-version: "${{ env.DOTNET_SDK_VERSION }}"
- name: Setup dotnet snapx
run: dotnet tool update snapx --global --version ${{ env.SNAPX_VERSION }}
- name: Download ${{ matrix.id }}-artifacts
uses: actions/download-artifact@v4
with:
name: ${{ matrix.id }}-artifacts
path: ${{ github.workspace }}/.snapx/artifacts/${{ matrix.id }}/${{ matrix.rid }}/${{ env.BUILD_VERSION }}
- name: Add demoapp nuget publish feed
shell: pwsh
run: |
$SourceUrl = Get-Content .snapx/update.json | ConvertFrom-Json | Select -ExpandProperty source
dotnet nuget add source ${SourceUrl} --name demoapp-publish-feed
- name: Generate snapx cache files
run: snapx restore --package-file ${{ matrix.id }}
- name: Restore snapx nuget packages for test release channel
uses: actions/cache@v4
with:
path: .snapx/packages/${{ matrix.id }}/${{ matrix.rid }}
key: ${{ matrix.id }}-test-${{ hashFiles('packages-test.txt') }}
- name: Publish ${{ matrix.id }} to test channel
run: snapx pack ${{ matrix.id }} --api-key ${{ secrets.DEMOAPP_PUBLISH_FEED_API_KEY }} -r ${{ matrix.rid }} -v ${{ env.BUILD_VERSION }} --lock-token ${{ secrets.SNAPX_TOKEN }} --lock-retries -1 -y