Skip to content

Commit

Permalink
Push packages regularly to GitHub Packages (#1206)
Browse files Browse the repository at this point in the history
Publish the latest code from master branch to GitHub Packages as Alpha-tagged prerelease NuGet packages.
  • Loading branch information
yaakov-h authored Mar 22, 2023
1 parent f66a348 commit 0d321f2
Show file tree
Hide file tree
Showing 3 changed files with 45 additions and 3 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/steamkit2-build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
Expand Down Expand Up @@ -61,6 +63,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
Expand All @@ -83,6 +87,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
Expand Down Expand Up @@ -110,6 +116,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Add MSBuild to PATH
uses: microsoft/setup-msbuild@v1
Expand All @@ -133,3 +141,28 @@ jobs:
with:
name: NetHook2
path: 'Resources/NetHook2/Release/*.dll'

gh-packages:
name: Publish to GitHub Packages
if: github.event_name != 'pull_request'
permissions:
packages: write

runs-on: windows-latest

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
with:
dotnet-version: 6.0.x

- name: Create NuGet Package
run: dotnet pack --configuration Release SteamKit2/SteamKit2/SteamKit2.csproj

- name: Publish NuGet Package to GitHub Packages
run: |
dotnet nuget push SteamKit2\SteamKit2\bin\Release\SteamKit2.*.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/SteamRE/index.json
9 changes: 9 additions & 0 deletions .github/workflows/steamkit2-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,9 @@ on:
release:
types: [ published ]

permissions:
packages: write

jobs:
publish-nupkg:
name: Publish NuGet Package
Expand All @@ -12,6 +15,8 @@ jobs:

steps:
- uses: actions/checkout@v3
with:
submodules: recursive

- name: Setup .NET Core
uses: actions/setup-dotnet@v3
Expand Down Expand Up @@ -41,3 +46,7 @@ jobs:
run: |
nuget setapikey ${{ secrets.NUGET_API_KEY }}
nuget push SteamKit2/SteamKit2/bin/Release/SteamKit2.${{ github.event.release.tag_name }}.nupkg -Source https://api.nuget.org/v3/index.json
- name: Publish NuGet Package to GitHub Packages
run: |
dotnet nuget push SteamKit2/SteamKit2/bin/Release/SteamKit2.${{ github.event.release.tag_name }}.nupkg --api-key ${{ secrets.GITHUB_TOKEN }} --source https://nuget.pkg.github.com/SteamRE/index.json
6 changes: 3 additions & 3 deletions Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -5,11 +5,11 @@
</PropertyGroup>

<PropertyGroup>
<SteamKitVersion Condition=" '$(GITHUB_RUN_NUMBER)' != ''">$(SteamKitBaseVersion).$(GITHUB_RUN_NUMBER)</SteamKitVersion>
<SteamKitVersion Condition=" '$(GITHUB_RUN_NUMBER)' == ''">$(SteamKitBaseVersion).0</SteamKitVersion>
<SteamKitVersion Condition=" '$(GITHUB_RUN_NUMBER)' != ''">$(SteamKitBaseVersion)-Alpha.$(GITHUB_RUN_NUMBER)</SteamKitVersion>
<SteamKitVersion Condition=" '$(GITHUB_RUN_NUMBER)' == ''">$(SteamKitBaseVersion)</SteamKitVersion>

<AssemblyVersion>$(SteamKitBaseVersion)</AssemblyVersion>
<FileVersion>$(SteamKitVersion)</FileVersion>
<FileVersion>$(SteamKitBaseVersion)</FileVersion>
<Version>$(SteamKitVersion)</Version>

<GitHubActionsRef Condition="$(GITHUB_REF.StartsWith('refs/heads/'))">$(GITHUB_REF.Substring(11))</GitHubActionsRef>
Expand Down

0 comments on commit 0d321f2

Please sign in to comment.