11name : " Release CLI"
2- on : workflow_dispatch # Run manually. Incomplete workflow
2+ on :
3+ release :
4+ types : [published]
35jobs :
4- build-windows :
6+ package :
57 runs-on : ubuntu-latest
8+ strategy :
9+ matrix :
10+ rid : ['win-x64', 'osx-x64', 'linux-x64']
611 env :
712 NUGET_URL : https://nuget.pkg.github.com/microsoft/index.json
13+ PACKAGE_VERSION : unversioned
14+ PACKAGE_TEMPLATE : msgraph-cli-{0}-{1}
15+ OUTPUT_DIR : /tmp/publish
816 steps :
917 - name : Checkout
1018 uses : actions/checkout@v2
1119 - name : Setup .NET Core SDK 6
1220 uses : actions/setup-dotnet@v1
1321 with :
1422 dotnet-version : 6.x
23+ - name : Set version
24+ run : PACKAGE_VERSION=$(echo -e ${{github.ref_name}} | tr -d 'v')
1525 - name : Add NuGet kiota source
1626 # NOTE: Password encryption is not supported for the linux platform (Encryption is only supported on Windows platforms.)
1727 run : |
@@ -23,33 +33,10 @@ jobs:
2333 key : ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
2434 restore-keys : |
2535 ${{ runner.os }}-nuget
26- - name : Install dependencies
27- run : dotnet restore
2836 - name : Build
29- run : dotnet publish --runtime win-x64 --self-contained true --configuration Release --no-restore
30- build-mac :
31- runs-on : ubuntu-latest
32- env :
33- NUGET_URL : https://nuget.pkg.github.com/microsoft/index.json
34- steps :
35- - name : Checkout
36- uses : actions/checkout@v2
37- - name : Setup .NET Core SDK 6
38- uses : actions/setup-dotnet@v1
39- with :
40- dotnet-version : 6.x
41- - name : Add NuGet kiota source
42- # NOTE: Password encryption is not supported for the linux platform (Encryption is only supported on Windows platforms.)
37+ run : dotnet publish --runtime ${{matrix.rid}} --self-contained true --configuration Release --output ${{env.OUTPUT_DIR}}
38+ - name : Package
4339 run : |
44- dotnet nuget add source ${{env.NUGET_URL}} -n github -u ${{secrets.NUGET_USER}} -p ${{secrets.NUGET_PASSWORD}} --store-password-in-clear-text
45- - uses : actions/cache@v2
46- with :
47- path : ~/.nuget/packages
48- # Look to see if there is a cache hit for the corresponding requirements file
49- key : ${{ runner.os }}-nuget-${{ hashFiles('**/packages.lock.json') }}
50- restore-keys : |
51- ${{ runner.os }}-nuget
52- - name : Install dependencies
53- run : dotnet restore
54- - name : Build
55- run : dotnet publish --runtime osx-x64 --self-contained true --configuration Release --no-restore
40+ zip format('${{env.PACKAGE_TEMPLATE}}.zip', '${{matrix.rid}}', $PACKAGE_VERSION) ${{env.OUTPUT_DIR}}/*
41+ - name : Add to release
42+ run : gh release upload ${{github.ref_name}} format('${{env.PACKAGE_TEMPLATE}}.zip', '${{matrix.rid}}', $PACKAGE_VERSION) --clobber
0 commit comments