[create-pull-request] automated change (#162) #410
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: .NET | |
on: | |
push: | |
branches: [ main ] | |
pull_request: | |
branches: [ main ] | |
workflow_dispatch: | |
inputs: | |
ReleaseVersion: | |
description: 'Release Version' | |
required: true | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: | | |
3.1.x | |
6.0.x | |
7.0.x | |
8.0.x | |
- name: Build | |
run: dotnet build src | |
- name: Test | |
run: dotnet test src --no-build --verbosity normal | |
- name: Pack | |
run: dotnet pack src --output nuget /p:ReleaseVersion=${{ github.event.inputs.ReleaseVersion }} | |
- name: Get package version | |
shell: pwsh | |
id: vars | |
run: | | |
$name = (gci nuget/*.nupkg -Recurse)[0].Name | |
$version = $name.Substring($name.IndexOf(".") + 1) | |
$version = $version.Substring(0, $version.LastIndexOf(".")) | |
Write-Output "PackageVersion=$version" | Out-File "${env:GITHUB_OUTPUT}" -Append | |
- name: Pack | |
run: | | |
cd src/Jab.Unity | |
npm version ${{ steps.vars.outputs.PackageVersion }} --allow-same-version | |
npm pack --pack-destination=../../nuget | |
- name: 'Upload Artifact' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: nuget | |
path: nuget/ | |
outputs: | |
PackageVersion: ${{ steps.vars.outputs.PackageVersion }} | |
test: | |
needs: build | |
strategy: | |
matrix: | |
sdk: | |
- 6.0.x | |
- 7.x | |
- 8.x | |
# https://github.com/microsoft/MSBuildSdks/issues/412 | |
# sdk: [6.0.x, 7.0.x] | |
include: | |
- sdk: 6.0.x | |
tfm: net6.0 | |
- sdk: 7.x | |
tfm: net7.0 | |
- sdk: 8.x | |
tfm: net8.0 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: nuget | |
path: nuget | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: ${{ matrix.sdk }} | |
- name: Get package version | |
shell: pwsh | |
id: vars | |
run: | | |
$name = (gci nuget/*.nupkg -Recurse)[0].Name | |
$version = $name.Substring($name.IndexOf(".") + 1) | |
$version = $version.Substring(0, $version.LastIndexOf(".")) | |
Write-Output "FunctionalTestPackageVersion=$version" | Out-File "${env:GITHUB_OUTPUT}" -Append | |
- name: Test | |
run: dotnet test eng/FunctionaTests.proj /p:FunctionalTestTargetFrameworks=${{ matrix.tfm }} /p:RestoreAdditionalProjectSources=${{ github.workspace }}/nuget /p:FunctionalTestPackageVersion=${{ needs.build.outputs.PackageVersion }} | |
publish: | |
if: (github.event_name == 'workflow_dispatch') && github.ref == 'refs/heads/main' | |
needs: [build, test] | |
runs-on: ubuntu-latest | |
steps: | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v2 | |
with: | |
name: nuget | |
path: nuget | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v1 | |
with: | |
dotnet-version: 6.0.x | |
- name: Publish unity packages to npm | |
shell: pwsh | |
run: | | |
npm config set //registry.npmjs.org/:_authToken ${{ secrets.NPM_KEY }} | |
npm whoami | |
npm publish ./nuget/com.pakrym.jab-${{ needs.build.outputs.PackageVersion }}.tgz | |
- name: Add GitHub package source | |
run: dotnet nuget add source https://nuget.pkg.github.com/pakrym/index.json --name "github" --username NotUsed --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text | |
- name: Publish NuGet packages to NuGet | |
run: dotnet nuget push nuget/*.nupkg --api-key ${{ secrets.NUGET_KEY }} --source "nuget.org" --skip-duplicate --no-symbols | |
update_versions: | |
needs: [build, publish] | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Update package versions in the repo | |
shell: pwsh | |
run: ./eng/UpdateAllVersions.ps1 ${{ needs.build.outputs.PackageVersion }} ${{ github.workspace }} | |
- name: Create Pull Request | |
uses: peter-evans/create-pull-request@v3 | |
with: | |
title: Update sample versions | |
branch: update-versions | |