Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
39 changes: 34 additions & 5 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,9 @@ on: ["workflow_dispatch", "push", "pull_request"]
jobs:
build:
runs-on: ubuntu-22.04
permissions:
contents: write
packages: write
steps:
- uses: actions/checkout@v4
with:
Expand Down Expand Up @@ -36,11 +39,37 @@ jobs:

- uses: actions/upload-artifact@v4
with:
name: AllOfUs.MiraAPI.nupkg
path: MiraAPI/bin/Release/AllOfUs.MiraAPI.*.nupkg

name: ClazAU.MiraAPI.nupkg
path: MiraAPI/bin/Release/ClazAU.MiraAPI.*.nupkg

# A push to main whose VersionPrefix has no v<version> tag yet publishes that version: the package to the
# ClazAU feed that mods compile against, and the DLL to a GitHub release. Asks the remote, since a shallow
# checkout has no tags.
- name: Check for an unreleased version
id: release
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
run: |
version=$(grep -oP '(?<=<VersionPrefix>)[^<]+' Directory.Build.props)
echo "version=$version" >> "$GITHUB_OUTPUT"
if [ -n "$(git ls-remote --tags origin "refs/tags/v$version")" ]; then
echo "publish=false" >> "$GITHUB_OUTPUT"
else
echo "publish=true" >> "$GITHUB_OUTPUT"
fi

- name: Build the release
if: steps.release.outputs.publish == 'true'
run: dotnet build MiraAPI/MiraAPI.csproj --configuration Release -p:Version=${{ steps.release.outputs.version }}

- name: Publish to the ClazAU NuGet feed
if: steps.release.outputs.publish == 'true'
run: >-
dotnet nuget push "MiraAPI/bin/Release/ClazAU.MiraAPI.${{ steps.release.outputs.version }}.nupkg"
--source "https://nuget.pkg.github.com/ClazAU/index.json"
--api-key "${{ secrets.GITHUB_TOKEN }}"

- uses: softprops/action-gh-release@v2
if: github.ref_type == 'tag'
if: steps.release.outputs.publish == 'true'
with:
draft: true
tag_name: v${{ steps.release.outputs.version }}
files: MiraAPI/bin/Release/net6.0/MiraAPI.dll
2 changes: 1 addition & 1 deletion Directory.Build.props
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<Authors>All Of Us, XtraCube, Angxl</Authors>
<Company>All Of Us</Company>
<RepositoryType>git</RepositoryType>
<RepositoryUrl>https://github.com/All-Of-Us-Mods/MiraAPI</RepositoryUrl>
<RepositoryUrl>https://github.com/ClazAU/MiraAPI</RepositoryUrl>
<PackageLicenseExpression>LGPL-2.1-or-later</PackageLicenseExpression>

<!-- SourceLink -->
Expand Down
2 changes: 1 addition & 1 deletion MiraAPI/MiraAPI.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
<PropertyGroup>
<LangVersion>preview</LangVersion>
<Description>Simple and easy to use Among Us modding API.</Description>
<PackageId>AllOfUs.MiraAPI</PackageId>
<PackageId>ClazAU.MiraAPI</PackageId>
<GeneratePackageOnBuild>true</GeneratePackageOnBuild>
<GenerateDocumentationFile>true</GenerateDocumentationFile>
<NoWarn>IDE0031;IDE0032</NoWarn>
Expand Down
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ Task("Build")

if (tag != null)
{
settings.MSBuildSettings.Version = tag;
settings.MSBuildSettings.Version = tag.TrimStart('v');
}
else if (buildId != 0)
{
Expand Down
Loading