v0.13.0 (#59) #25
Workflow file for this run
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 to NuGet | |
on: | |
push: | |
tags: | |
- "v[0-9]+.[0-9]+.[0-9]+" | |
- "v[0-9]+.[0-9]+.[0-9]+-[a-z]+.[0-9]+" | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
dotnet-configuration: [Release] | |
steps: | |
- name: Install .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: '3.1.x' | |
- name: Check out code | |
uses: actions/checkout@v3 | |
- name: Adding /tmp/output | |
run: mkdir -p /tmp/output | |
- name: Set VERSION variable from tag | |
run: echo "VERSION=${GITHUB_REF/refs\/tags\/v/}" >> $GITHUB_ENV | |
- name: Verify commit exists in origin/main | |
run: | | |
git fetch --no-tags --prune --depth=1 origin +refs/heads/*:refs/remotes/origin/* | |
git branch --remote --contains | grep origin/main | |
# have we configured the generator? | |
- name: Verify that the version exists in generator-config (have we updated versions?) | |
run: 'sudo apt-get install -y jq && [[ "$(jq -r ".packageVersion" gen/generator-config.json)" == "$VERSION" ]]' | |
# have we run the generator? | |
# TODO: once the OAS document is more readily available publicly, we can pull it here. | |
- name: Verify that the version exists in the built artifact | |
run: 'sudo apt-get install -y xmlstarlet && [[ $(cat ./src/Mux.Csharp.Sdk/Mux.Csharp.Sdk.csproj | xmlstarlet sel -t -v "/Project/PropertyGroup/Version/text()") == "$VERSION" ]]' | |
- name: Build for ${{ matrix.dotnet-configuration }} | |
run: dotnet build --configuration ${{ matrix.dotnet-configuration }} /p:Version=${VERSION} | |
- name: Test for ${{ matrix.dotnet-configuration }} | |
env: | |
MUX_TOKEN_ID: "${{ secrets.MUX_TOKEN_ID }}" | |
MUX_TOKEN_SECRET: "${{ secrets.MUX_TOKEN_SECRET }}" | |
run: dotnet test --configuration ${{ matrix.dotnet-configuration }} /p:Version=${VERSION} --no-build | |
- name: Pack for ${{ matrix.dotnet-configuration }} | |
run: cp README.md icon.png src/Mux.Csharp.Sdk && dotnet pack --configuration ${{ matrix.dotnet-configuration }} /p:Version=${VERSION} --no-build --property:PackageOutputPath=/tmp/output | |
- name: Uploading artifact for ${{ matrix.dotnet-configuration }} | |
uses: actions/upload-artifact@v2 | |
with: | |
name: Mux.Csharp.Sdk-${{ matrix.dotnet-configuration }} | |
path: /tmp/output/* | |
- name: Push | |
env: | |
NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} | |
run: dotnet nuget push /tmp/output/*.nupkg --source https://api.nuget.org/v3/index.json --api-key ${NUGET_API_KEY} |