[net]build: use SailsPackagesVersionInternal property #30
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: '[net] Release' | |
on: | |
push: | |
tags: | |
- 'net/v*' | |
env: | |
# see https://api.github.com/users/github-actions%5Bbot%5D | |
GITHUB_USER_NAME: github-actions[bot] | |
GITHUB_USER_EMAIL: 41898282+github-actions[bot]@users.noreply.github.com | |
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: ${{ steps.release_info.outputs.r_tag }} | |
steps: | |
- name: Extract Release Info | |
id: release_info | |
run: | | |
R_TAG=${GITHUB_REF#refs/tags/} | |
VERSION=${R_TAG#net/v} | |
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 "Release Tag: $R_TAG" | |
echo "r_tag=$R_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: Build & Test Solution | |
run: | | |
dotnet build --configuration Release \ | |
-p:LibraryRoot=${{ github.workspace }}/native_client_gens | |
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: Build & Test Solution with New NuGet Packages | |
run: | | |
dotnet nuget add source ${{ github.workspace }}/nugets --name local | |
dotnet build --configuration Release \ | |
-p:LibraryRoot=${{ github.workspace }}/native_client_gens \ | |
-p:SailsPackagesVersion=${{ needs.prepare.outputs.r_version }} | |
dotnet test --no-build --configuration Release --logger "trx;LogFileName=TestResults.trx" | |
- name: Publish NuGet Packages to NuGet.org | |
if: false | |
run: | | |
dotnet nuget push ./nugets/*.nupkg \ | |
--source https://api.nuget.org/v3/index.json \ | |
--api-key ${{ secrets.NUGET_ORG_API_KEY }} | |
release: | |
if: false | |
name: Create Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
needs: | |
- prepare | |
- publish | |
defaults: | |
run: | |
shell: bash | |
env: | |
R_NAME: Sails-Net v${{ needs.prepare.outputs.r_version }} | |
steps: | |
- name: Checkout Code | |
uses: actions/checkout@v4 | |
- name: Create Draft Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
name: ${{ env.R_NAME }} | |
tag_name: ${{ needs.prepare.outputs.r_tag }} | |
draft: true | |
body: | | |
:exclamation: This is a draft release. | |
:exclamation: Please write/generate change notes and publish the release. | |
fail_on_unmatched_files: true | |
token: ${{ secrets.GITHUB_TOKEN }} |