Skip to content

fix nuget sources setup #19

fix nuget sources setup

fix nuget sources setup #19

Workflow file for this run

name: '[net] Release'
on:
push:
tags:
- 'net/v*-pin'
jobs:
prepare:
name: Prepare Release
runs-on: ubuntu-latest
permissions:
contents: write
defaults:
run:
shell: bash
outputs:
r_version: ${{ steps.release_info.outputs.version }}
r_tag: rs/v${{ steps.release_info.outputs.version }}
steps:
- name: Extract Release Info
id: release_info
run: |
PIN_TAG=${GITHUB_REF#refs/tags/}
VERSION=${PIN_TAG#net/v}
VERSION="${VERSION%-pin}"
if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?$ ]]; then
echo "'$VERSION' is not a valid semver version"
exit 1
fi
echo "Pin Tag: $PIN_TAG"
echo "pin_tag=$PIN_TAG" >> $GITHUB_OUTPUT
echo "Version: $VERSION"
echo "version=$VERSION" >> $GITHUB_OUTPUT
build_win_x64:
name: Build Native Libraries for Win x64
needs: prepare
runs-on: windows-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build & Test Client Generator
run: |
cargo build --locked --manifest-path net/rs/Cargo.toml --release
cargo test --locked --manifest-path net/rs/Cargo.toml --release
mkdir -p ./net/rs/target/artifacts/win-x64
cp ./net/rs/target/release/sails_net_client_gen.dll ./net/rs/target/artifacts/win-x64
- name: Upload Client Generator Artifacts
uses: actions/upload-artifact@v4
with:
name: native_client_gen_win_x64
path: ./net/rs/target/artifacts
build_linux_x64:
name: Build Native Libraries for Linux x64
needs: prepare
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build & Test Client Generator
run: |
cargo build --locked --manifest-path net/rs/Cargo.toml --release
cargo test --locked --manifest-path net/rs/Cargo.toml --release
mkdir -p ./net/rs/target/artifacts/linux-x64
cp ./net/rs/target/release/libsails_net_client_gen.so ./net/rs/target/artifacts/linux-x64
- name: Upload Client Generator Artifacts
uses: actions/upload-artifact@v4
with:
name: native_client_gen_linux_x64
path: ./net/rs/target/artifacts
build_osx_x64:
name: Build Native Libraries for NacOS x64
needs: prepare
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build & Test Client Generator
run: |
rustup target add x86_64-apple-darwin
cargo build --locked --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin
cargo test --locked --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin
mkdir -p ./net/rs/target/artifacts/osx-x64
cp ./net/rs/target/x86_64-apple-darwin/release/libsails_net_client_gen.dylib ./net/rs/target/artifacts/osx-x64
- name: Upload Client Generator Artifacts
uses: actions/upload-artifact@v4
with:
name: native_client_gen_osx_x64
path: ./net/rs/target/artifacts
build_osx_arm64:
name: Build Native Libraries for MacOS ARM64
needs: prepare
runs-on: macos-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Build & Test Client Generator
run: |
rustup target add aarch64-apple-darwin
cargo build --locked --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin
cargo test --locked --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin
mkdir -p ./net/rs/target/artifacts/osx-arm64
cp ./net/rs/target/aarch64-apple-darwin/release/libsails_net_client_gen.dylib ./net/rs/target/artifacts/osx-arm64
- name: Upload Client Generator Artifacts
uses: actions/upload-artifact@v4
with:
name: native_client_gen_osx_arm64
path: ./net/rs/target/artifacts
publish:
name: Publish NuGet Packages
needs:
- prepare
- build_win_x64
- build_linux_x64
- build_osx_x64
- build_osx_arm64
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v4
- name: Download Native Libraries
uses: actions/download-artifact@v4
with:
path: native_client_gens
pattern: native_client_gen_*
merge-multiple: true
- name: Set Up NuGet Sources
run: |
NUGET_SOURCE_URL="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json"
dotnet nuget remove source ${{ github.repository_owner }}-github || true
dotnet nuget add source $NUGET_SOURCE_URL \
--name ${{ github.repository_owner }}-github \
--username "${{ github.workflow }}" \
--password ${{ secrets.GITHUB_TOKEN }} \
--store-password-in-clear-text
- name: Build Solution
run: |
dotnet build --configuration Release -p:LibraryRoot=${{ github.workspace }}/native_client_gens
- name: Test Solution
run: |
dotnet test --no-build --configuration Release --logger "trx;LogFileName=TestResults.trx"
- name: Pack NuGet Packages
run: |
dotnet pack ./net/src/Sails.Net/Sails.Net.csproj --no-build --configuration Release --output ./nugets \
-p:Version=${{ needs.prepare.outputs.r_version }} \
-p:PackageVersion=${{ needs.prepare.outputs.r_version }} \
-p:RepositoryUrl=${{ github.server_url }}/${{ github.repository }} \
-p:Authors=Gear
dotnet pack ./net/src/Sails.ClientGenerator/Sails.ClientGenerator.csproj --no-build --configuration Release --output ./nugets \
-p:Version=${{ needs.prepare.outputs.r_version }} \
-p:PackageVersion=${{ needs.prepare.outputs.r_version }} \
-p:RepositoryUrl=${{ github.server_url }}/${{ github.repository }} \
-p:Authors=Gear
- name: Publish NuGet Packages
run: |
dotnet nuget push ./nugets/*.nupkg \
--source $NUGET_SOURCE_URL