From 1f1fa08887ce3fca3dfa44554179da52c1f016e9 Mon Sep 17 00:00:00 2001 From: Nuclearist Date: Sat, 13 Jan 2024 01:47:54 +0300 Subject: [PATCH] Added GitHub Actions --- .github/dependabot.yml | 14 +++++++++++++ .github/workflows/build.yaml | 31 ++++++++++++++++++++++++++++ .github/workflows/release.yaml | 37 ++++++++++++++++++++++++++++++++++ TEKSteamClient.csproj | 4 +++- 4 files changed, 85 insertions(+), 1 deletion(-) create mode 100644 .github/dependabot.yml create mode 100644 .github/workflows/build.yaml create mode 100644 .github/workflows/release.yaml diff --git a/.github/dependabot.yml b/.github/dependabot.yml new file mode 100644 index 0000000..43a1b9c --- /dev/null +++ b/.github/dependabot.yml @@ -0,0 +1,14 @@ +version: 2 +updates: +- package-ecosystem: nuget + directory: "/" + schedule: + interval: daily + +- package-ecosystem: "github-actions" + directory: "/" + schedule: + interval: weekly + ignore: + - dependency-name: "*" + update-types: ["version-update:semver-minor", "version-update:semver-patch"] \ No newline at end of file diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml new file mode 100644 index 0000000..0de3e2e --- /dev/null +++ b/.github/workflows/build.yaml @@ -0,0 +1,31 @@ +name: Build and upload snapshot package + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + build-package: + name: Build and upload snapshot package + permissions: + packages: write + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Create NuGet Package + run: dotnet pack + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: TEKSteamClient.nupkg + path: 'bin/Release/*.*upkg' + - name: Publish to GitHub Packages + run: dotnet nuget push bin/Release/*.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/Nuclearistt/index.json \ No newline at end of file diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml new file mode 100644 index 0000000..ab1e95e --- /dev/null +++ b/.github/workflows/release.yaml @@ -0,0 +1,37 @@ +name: Publish release package + +on: + release: + types: [ published ] + +permissions: + contents: write + packages: write + +jobs: + publish-nupkg: + name: Publish NuGet package + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + - name: Setup .NET + uses: actions/setup-dotnet@v4 + with: + dotnet-version: 8.0.x + - name: Create NuGet Package + run: dotnet pack /p:Version=${{ github.event.release.name }} + - name: Upload artifact + uses: actions/upload-artifact@v4 + with: + name: 'TEKSteamClient.${{ github.event.release.name }}.nupkg' + path: 'bin/Release/TEKSteamClient.${{ github.event.release.name }}.*upkg' + - name: Upload to GitHub release + uses: softprops/action-gh-release@v1 + with: + files: 'bin/Release/TEKSteamClient.${{ github.event.release.name }}.*upkg' + - name: Publish to NuGet + run: dotnet nuget push bin/Release/TEKSteamClient.${{ github.event.release.name }}.nupkg -k ${{ secrets.NUGET_API_KEY }} -s https://api.nuget.org/v3/index.json + - name: Publish to GitHub Packages + run: dotnet nuget push bin/Release/TEKSteamClient.${{ github.event.release.name }}.nupkg -k ${{ secrets.GITHUB_TOKEN }} -s https://nuget.pkg.github.com/Nuclearistt/index.json \ No newline at end of file diff --git a/TEKSteamClient.csproj b/TEKSteamClient.csproj index 4e8c843..986d60b 100644 --- a/TEKSteamClient.csproj +++ b/TEKSteamClient.csproj @@ -1,7 +1,9 @@ net8.0 - 1.1.0 + 1.1.0 + $(BaseVersion) + $(BaseVersion)-alpha.$(GITHUB_RUN_NUMBER) Nuclearist TEK Steam Client library TEK Steam Client