From 86297d20ef1fd1290a727a74e7f2b7e011fa08c8 Mon Sep 17 00:00:00 2001 From: Camille Galladjov Date: Sun, 10 Jan 2021 18:57:18 +0300 Subject: [PATCH] created github action to pack and publish nuget package + manual workflow trigger --- .github/workflows/nuget-release.yml | 69 +++++++++++++++++++++++++++++ .github/workflows/upm-release.yml | 6 ++- Svelto.ECS/Svelto.ECS.csproj | 4 ++ 3 files changed, 78 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/nuget-release.yml diff --git a/.github/workflows/nuget-release.yml b/.github/workflows/nuget-release.yml new file mode 100644 index 0000000..37915df --- /dev/null +++ b/.github/workflows/nuget-release.yml @@ -0,0 +1,69 @@ +name: Svelto.ECS Nuget Release + +on: + workflow_dispatch: + inputs: + name: + description: 'Reason' + default: 'Manual workflow triggering' + push: + branches: + - master + paths: + - ./Svelto.ECS/version.json + +jobs: + build: + env: + PKG_NAME: Svelto.ECS + ECS_VERSION_JSON: ./Svelto.ECS/version.json + COMMON_VERSION_JSON: ./Svelto.Common/version.json + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v2 + + - name: init submodules + run: git submodule update --init + + - name: get preparation tools + run: git clone https://github.com/Ujinjinjin/upm-preparator.git --branch v1.0.12 --single-branch + + - name: create temp directory + run: mkdir temp + + - name: create solution file + run: dotnet new sln -n "${PKG_NAME}" -o temp/ + + # Svelto.Common + - name: get Svelto.Common version + run: python3 upm-preparator/version.py --version-file "${COMMON_VERSION_JSON}" --env-file "${GITHUB_ENV}" + + - name: create temp Svelto.Common directory + run: mkdir "temp/com.sebaslab.svelto.common@${PKG_VERSION}" + + - name: copy Svelto.Common files to temp directory + run: cp -r Svelto.Common/* "temp/com.sebaslab.svelto.common@${PKG_VERSION}" + + - name: add Svelto.Common to solution + run: dotnet sln "temp/${PKG_NAME}.sln" add "temp/com.sebaslab.svelto.common@${PKG_VERSION}/Svelto.Common.csproj" + + # Svelto.ECS + - name: get Svelto.ECS version + run: python3 upm-preparator/version.py --version-file "${ECS_VERSION_JSON}" --env-file "${GITHUB_ENV}" + + - name: create temp Svelto.ECS directory + run: mkdir "temp/com.sebaslab.svelto.ecs@${PKG_VERSION}" + + - name: copy Svelto.ECS files to temp directory + run: cp -r Svelto.ECS/* "temp/com.sebaslab.svelto.ecs@${PKG_VERSION}" + + - name: add Svelto.ECS to solution + run: dotnet sln "temp/${PKG_NAME}.sln" add "temp/com.sebaslab.svelto.ecs@${PKG_VERSION}/Svelto.ECS.csproj" + + - name: build nuget package + run: dotnet pack /p:Version=${PKG_VERSION} -o . "temp/com.sebaslab.svelto.ecs@${PKG_VERSION}/Svelto.ECS.csproj" + + - name: publish nuget package + run: dotnet nuget push ${{ env.PKG_NAME }}.${{ env.PKG_VERSION }}.nupkg --api-key ${{ secrets.NUGET_API_KEY }} --source https://api.nuget.org/v3/index.json \ No newline at end of file diff --git a/.github/workflows/upm-release.yml b/.github/workflows/upm-release.yml index c88be3d..1d291f2 100644 --- a/.github/workflows/upm-release.yml +++ b/.github/workflows/upm-release.yml @@ -1,12 +1,16 @@ name: Svelto.ECS UPM Release on: + workflow_dispatch: + inputs: + name: + description: 'Reason' + default: 'Manual workflow triggering' push: branches: - master paths: - ./Svelto.ECS/version.json - - ".github/workflows/upm-release.yml" jobs: build: diff --git a/Svelto.ECS/Svelto.ECS.csproj b/Svelto.ECS/Svelto.ECS.csproj index d480b8a..ebcf716 100644 --- a/Svelto.ECS/Svelto.ECS.csproj +++ b/Svelto.ECS/Svelto.ECS.csproj @@ -4,6 +4,10 @@ 7.3 netstandard2.0 + + Svelto.ECS + sebas77 + AnyCPU false