Update schema #17
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
# This workflow will build a .NET project | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-net | |
name: .NET | |
on: | |
push: | |
branches: [ "main" ] | |
release: | |
types: | |
- published | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
version: ${{ steps.versioning.outputs.version }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- name: Get Version | |
id: versioning | |
uses: paulhatch/[email protected] | |
with: | |
version_format: "${major}.${minor}.${patch}" | |
- name: Set VERSION variable from tag | |
env: | |
VERSION: ${{ steps.versioning.outputs.version }} | |
run: echo "VERSION=${VERSION}" >> $GITHUB_ENV | |
- name: Setup .NET | |
uses: actions/setup-dotnet@v3 | |
with: | |
dotnet-version: 6.0.x | |
- name: Build | |
run: dotnet build --configuration Release /p:Version=${VERSION} | |
- name: Upload FinolDigital.Cgs.CardGameDef.dll | |
uses: actions/upload-artifact@v3 | |
with: | |
name: FinolDigital.Cgs.CardGameDef.dll | |
path: FinolDigital.Cgs.CardGameDef/bin/Release/netstandard2.1/FinolDigital.Cgs.CardGameDef.dll | |
- name: Generate schema | |
run: dotnet SchemaGeneration/bin/Release/net6.0/SchemaGeneration.dll | |
- name: Upload CardGameDef.json | |
uses: actions/upload-artifact@v3 | |
with: | |
name: CardGameDef.json | |
path: CardGameDef.json | |
- name: Pack | |
run: dotnet pack --configuration Release /p:Version=${VERSION} | |
- name: Upload nuget package | |
uses: actions/upload-artifact@v3 | |
with: | |
name: FinolDigital.Cgs.CardGameDef.${{ steps.versioning.outputs.version }}.nupkg | |
path: FinolDigital.Cgs.CardGameDef/bin/Release/FinolDigital.Cgs.CardGameDef.${{ steps.versioning.outputs.version }}.nupkg | |
- name: Update nuget settings | |
if: github.event.action == 'published' | |
run: dotnet nuget add source --username [email protected] --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/finol-digital/index.json" | |
- name: Push nuget package | |
if: github.event.action == 'published' | |
run: dotnet nuget push "FinolDigital.Cgs.CardGameDef/bin/Release/FinolDigital.Cgs.CardGameDef.${VERSION}.nupkg" --source "github" | |
updateCgs: | |
name: Update CGS | |
runs-on: ubuntu-latest | |
needs: build | |
if: github.event.action == 'published' | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
with: | |
path: FinolDigital.Cgs.CardGameDef | |
- name: Checkout CGS project | |
uses: actions/checkout@v3 | |
with: | |
repository: finol-digital/Card-Game-Simulator | |
token: ${{ secrets.CGS_PAT }} | |
path: Card-Game-Simulator | |
lfs: true | |
- name: Download FinolDigital.Cgs.CardGameDef.dll | |
uses: actions/download-artifact@v3 | |
with: | |
name: FinolDigital.Cgs.CardGameDef.dll | |
path: Card-Game-Simulator/Assets/Plugins | |
- name: Download CardGameDef.json | |
uses: actions/download-artifact@v3 | |
with: | |
name: CardGameDef.json | |
path: Card-Game-Simulator/docs/schema | |
- name: Raise PR to Card-Game-Simulator | |
uses: peter-evans/create-pull-request@v5 | |
with: | |
token: ${{ secrets.CGS_PAT }} | |
path: Card-Game-Simulator | |
branch: cardgamedef-${{ needs.build.outputs.version }} | |
title: CardGameDef ${{ needs.build.outputs.version }} |