From 06daadedff9b212b41da581fce48e450863c6404 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Thu, 21 Nov 2024 15:10:06 +0000 Subject: [PATCH 01/21] [net]build(gh): introduce GH workflow for .Net release --- .github/workflows/net-ci.yml | 2 +- .github/workflows/net-release.yml | 74 +++++++++++++++++++++++++++++++ 2 files changed, 75 insertions(+), 1 deletion(-) diff --git a/.github/workflows/net-ci.yml b/.github/workflows/net-ci.yml index 7cac0ebc..e698b6d1 100644 --- a/.github/workflows/net-ci.yml +++ b/.github/workflows/net-ci.yml @@ -16,7 +16,7 @@ on: - 'Sales.Net.sln' jobs: - build-test: + build_test: name: Build & Test runs-on: ubuntu-latest defaults: diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 6e66f7b1..59cecc40 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -6,6 +6,80 @@ on: - 'net/v*-pin' jobs: + build_win_x64: + name: Build Native Libraries for Win x64 + runs-on: windows-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Build Client Generator + run: | + cargo build --manifest-path net/rs/Cargo.toml --release + + - name: Upload Client Generator Artifacts + uses: actions/upload-artifact@v4 + with: + name: win_x64 + path: ./net/rs/target/release/sails_net_client_gen.dll + + build_linux_x64: + name: Build Native Libraries for Linux x64 + runs-on: ubuntu-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Build Client Generator + run: | + cargo build --manifest-path net/rs/Cargo.toml --release + + - name: Upload Client Generator Artifacts + uses: actions/upload-artifact@v4 + with: + name: linux_x64 + path: ./net/rs/target/release/libsails_net_client_gen.so + + osx_x64: + name: Build Native Libraries for NacOS x64 + runs-on: macos-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Build Client Generator + run: | + rustup target add x86_64-apple-darwin + cargo build --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin + + - name: Upload Client Generator Artifacts + uses: actions/upload-artifact@v4 + with: + name: osx_x64 + path: ./net/rs/target/x86_64-apple-darwin/release/libsails_net_client_gen.dylib + + osx_arm64: + name: Build Native Libraries for MacOS ARM64 + runs-on: macos-latest + + steps: + - name: Checkout Code + uses: actions/checkout@v4 + + - name: Build Client Generator + run: | + rustup target add aarch64-apple-darwin + cargo build --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin + + - name: Upload Client Generator Artifacts + uses: actions/upload-artifact@v4 + with: + name: osx_arm64 + path: ./net/rs/target/aarch64-apple-darwin/release/libsails_net_client_gen.dylib + prepare: name: Prepare Release runs-on: ubuntu-latest From cf15356e0a91b3b829ffc15a134514145ebe2e44 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Thu, 21 Nov 2024 15:27:56 +0000 Subject: [PATCH 02/21] . --- .github/workflows/net-release.yml | 63 ++++++++++++++++++++----------- 1 file changed, 42 insertions(+), 21 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 59cecc40..3becf320 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -6,17 +6,47 @@ on: - '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]+$ ]]; 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 Client Generator + - name: Build & Test Client Generator run: | cargo build --manifest-path net/rs/Cargo.toml --release + cargo test --manifest-path net/rs/Cargo.toml --release - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 @@ -26,15 +56,17 @@ jobs: 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 Client Generator + - name: Build & Test Client Generator run: | cargo build --manifest-path net/rs/Cargo.toml --release + cargo test --manifest-path net/rs/Cargo.toml --release - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 @@ -42,18 +74,20 @@ jobs: name: linux_x64 path: ./net/rs/target/release/libsails_net_client_gen.so - osx_x64: + 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 Client Generator + - name: Build & Test Client Generator run: | rustup target add x86_64-apple-darwin cargo build --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin + cargo test --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 @@ -61,36 +95,23 @@ jobs: name: osx_x64 path: ./net/rs/target/x86_64-apple-darwin/release/libsails_net_client_gen.dylib - osx_arm64: + 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 Client Generator + - name: Build & Test Client Generator run: | rustup target add aarch64-apple-darwin cargo build --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin + cargo test --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: name: osx_arm64 path: ./net/rs/target/aarch64-apple-darwin/release/libsails_net_client_gen.dylib - - prepare: - name: Prepare Release - runs-on: ubuntu-latest - permissions: - contents: write - defaults: - run: - shell: bash - - steps: - - name: Checkout Code - uses: actions/checkout@v4 - with: - token: ${{ secrets.GITHUB_TOKEN }} From c5733dfed2e25be5f93404d6d76dd3a22eded591 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Thu, 21 Nov 2024 16:16:30 +0000 Subject: [PATCH 03/21] build and test .Net --- .github/workflows/net-release.yml | 53 +++++++++++++++++++++++-------- 1 file changed, 39 insertions(+), 14 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 3becf320..c9c5bc3b 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -45,13 +45,13 @@ jobs: - name: Build & Test Client Generator run: | - cargo build --manifest-path net/rs/Cargo.toml --release - cargo test --manifest-path net/rs/Cargo.toml --release + cargo build --manifest-path net/rs/Cargo.toml --release + cargo test --manifest-path net/rs/Cargo.toml --release - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: - name: win_x64 + name: native_client_gen_win_x64 path: ./net/rs/target/release/sails_net_client_gen.dll build_linux_x64: @@ -65,13 +65,13 @@ jobs: - name: Build & Test Client Generator run: | - cargo build --manifest-path net/rs/Cargo.toml --release - cargo test --manifest-path net/rs/Cargo.toml --release + cargo build --manifest-path net/rs/Cargo.toml --release + cargo test --manifest-path net/rs/Cargo.toml --release - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: - name: linux_x64 + name: native_client_gen_linux_x64 path: ./net/rs/target/release/libsails_net_client_gen.so build_osx_x64: @@ -85,14 +85,14 @@ jobs: - name: Build & Test Client Generator run: | - rustup target add x86_64-apple-darwin - cargo build --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin - cargo test --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin + rustup target add x86_64-apple-darwin + cargo build --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin + cargo test --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: - name: osx_x64 + name: native_client_gen_osx_x64 path: ./net/rs/target/x86_64-apple-darwin/release/libsails_net_client_gen.dylib build_osx_arm64: @@ -106,12 +106,37 @@ jobs: - name: Build & Test Client Generator run: | - rustup target add aarch64-apple-darwin - cargo build --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin - cargo test --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin + rustup target add aarch64-apple-darwin + cargo build --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin + cargo test --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: - name: osx_arm64 + name: native_client_gen_osx_arm64 path: ./net/rs/target/aarch64-apple-darwin/release/libsails_net_client_gen.dylib + + publish: + name: Publish NuGet Packages + needs: + - 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_* + + - name: Build & Test Solution + run: >- + dotnet test --configuration Release + -p:LibraryRoot=${{ github.workspace }}/native_client_gens + --logger "trx;LogFileName=TestResults.trx" From 2d5e86aa951ce3e4c0969a4b1b785577b3ea5380 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Thu, 21 Nov 2024 16:26:54 +0000 Subject: [PATCH 04/21] split build and test --- .github/workflows/net-release.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index c9c5bc3b..657515be 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -135,8 +135,10 @@ jobs: path: native_client_gens pattern: native_client_gen_* - - name: Build & Test Solution - run: >- - dotnet test --configuration Release - -p:LibraryRoot=${{ github.workspace }}/native_client_gens - --logger "trx;LogFileName=TestResults.trx" + - 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" From 3e2d94ab66679da7887a48abd661619ceed97d07 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Thu, 21 Nov 2024 17:12:07 +0000 Subject: [PATCH 05/21] fix artifacts structure --- .github/workflows/net-release.yml | 33 ++++++++++++++++++++----------- 1 file changed, 21 insertions(+), 12 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 657515be..607dcd2d 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -45,14 +45,16 @@ jobs: - name: Build & Test Client Generator run: | - cargo build --manifest-path net/rs/Cargo.toml --release - cargo test --manifest-path net/rs/Cargo.toml --release + 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/release/win-x64 && \ + cp ./net/rs/target/release/sails_net_client_gen.dll ./net/rs/target/release/win-x64 - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: name: native_client_gen_win_x64 - path: ./net/rs/target/release/sails_net_client_gen.dll + path: ./net/rs/target/release/win-x64 build_linux_x64: name: Build Native Libraries for Linux x64 @@ -65,14 +67,16 @@ jobs: - name: Build & Test Client Generator run: | - cargo build --manifest-path net/rs/Cargo.toml --release - cargo test --manifest-path net/rs/Cargo.toml --release + 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/release/linux-x64 && \ + cp ./net/rs/target/release/libsails_net_client_gen.so ./net/rs/target/release/linux-x64 - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: name: native_client_gen_linux_x64 - path: ./net/rs/target/release/libsails_net_client_gen.so + path: ./net/rs/target/release/linux-x64 build_osx_x64: name: Build Native Libraries for NacOS x64 @@ -86,14 +90,16 @@ jobs: - name: Build & Test Client Generator run: | rustup target add x86_64-apple-darwin - cargo build --manifest-path net/rs/Cargo.toml --release --target x86_64-apple-darwin - cargo test --manifest-path net/rs/Cargo.toml --release --target 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/release/osx-x64 && \ + cp ./net/rs/target/x86_64-apple-darwin/release/libsails_net_client_gen.dylib ./net/rs/target/release/osx-x64 - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: name: native_client_gen_osx_x64 - path: ./net/rs/target/x86_64-apple-darwin/release/libsails_net_client_gen.dylib + path: ./net/rs/target/release/osx-x64 build_osx_arm64: name: Build Native Libraries for MacOS ARM64 @@ -107,14 +113,16 @@ jobs: - name: Build & Test Client Generator run: | rustup target add aarch64-apple-darwin - cargo build --manifest-path net/rs/Cargo.toml --release --target aarch64-apple-darwin - cargo test --manifest-path net/rs/Cargo.toml --release --target 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/release/osx-arm64 && \ + cp ./net/rs/target/aarch64-apple-darwin/release/libsails_net_client_gen.dylib ./net/rs/target/release/osx-arm64 - name: Upload Client Generator Artifacts uses: actions/upload-artifact@v4 with: name: native_client_gen_osx_arm64 - path: ./net/rs/target/aarch64-apple-darwin/release/libsails_net_client_gen.dylib + path: ./net/rs/target/release/osx-arm64 publish: name: Publish NuGet Packages @@ -134,6 +142,7 @@ jobs: with: path: native_client_gens pattern: native_client_gen_* + merge-multiple: true - name: Build Solution run: | From e49057214216fb4a31684681d5ff22fa77be2ff4 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Thu, 21 Nov 2024 17:21:42 +0000 Subject: [PATCH 06/21] artifacts structure --- .github/workflows/net-release.yml | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 607dcd2d..7582fe67 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -47,14 +47,14 @@ jobs: 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/release/win-x64 && \ - cp ./net/rs/target/release/sails_net_client_gen.dll ./net/rs/target/release/win-x64 + 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/release/win-x64 + path: ./net/rs/target/artifacts build_linux_x64: name: Build Native Libraries for Linux x64 @@ -69,14 +69,14 @@ jobs: 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/release/linux-x64 && \ - cp ./net/rs/target/release/libsails_net_client_gen.so ./net/rs/target/release/linux-x64 + 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/release/linux-x64 + path: ./net/rs/target/artifacts build_osx_x64: name: Build Native Libraries for NacOS x64 @@ -92,14 +92,14 @@ jobs: 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/release/osx-x64 && \ - cp ./net/rs/target/x86_64-apple-darwin/release/libsails_net_client_gen.dylib ./net/rs/target/release/osx-x64 + 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/release/osx-x64 + path: ./net/rs/target/artifacts build_osx_arm64: name: Build Native Libraries for MacOS ARM64 @@ -115,14 +115,14 @@ jobs: 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/release/osx-arm64 && \ - cp ./net/rs/target/aarch64-apple-darwin/release/libsails_net_client_gen.dylib ./net/rs/target/release/osx-arm64 + 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/release/osx-arm64 + path: ./net/rs/target/artifacts publish: name: Publish NuGet Packages From c5232fab75291898af64db9c045c413e4b5aa2a5 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 12:38:48 +0000 Subject: [PATCH 07/21] pack sails.net --- .github/workflows/net-release.yml | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 7582fe67..53f00638 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -33,6 +33,7 @@ jobs: echo "pin_tag=$PIN_TAG" >> $GITHUB_OUTPUT echo "Version: $VERSION" echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "Repository Url : ${{ github.server_url }}/${{ github.repository }}" build_win_x64: name: Build Native Libraries for Win x64 @@ -127,6 +128,7 @@ jobs: publish: name: Publish NuGet Packages needs: + - prepare - build_win_x64 - build_linux_x64 - build_osx_x64 @@ -151,3 +153,10 @@ jobs: - 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 }} From 021d9ea878de6138de47cb421e186e58c8fe7619 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 12:46:41 +0000 Subject: [PATCH 08/21] upload nugets as artifacts --- .github/workflows/net-release.yml | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 53f00638..ffec9aa7 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -33,7 +33,6 @@ jobs: echo "pin_tag=$PIN_TAG" >> $GITHUB_OUTPUT echo "Version: $VERSION" echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "Repository Url : ${{ github.server_url }}/${{ github.repository }}" build_win_x64: name: Build Native Libraries for Win x64 @@ -160,3 +159,15 @@ jobs: -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: Upload NuGet Packages + uses: actions/upload-artifact@v4 + with: + name: nuget_packages + path: ./nugets From 44aef3447e3213d5f5f73aafad265fdb81d3b6e4 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 13:07:21 +0000 Subject: [PATCH 09/21] fix --- .github/workflows/net-release.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index ffec9aa7..05984bae 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -158,12 +158,12 @@ jobs: 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: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:RepositoryUrl=${{ github.server_url }}/${{ github.repository }} \ -p:Authors=Gear - name: Upload NuGet Packages From 43b7cd59181007b65fb55bd35177544d7771be9e Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 13:46:04 +0000 Subject: [PATCH 10/21] auth against GH NuGets --- .github/workflows/net-release.yml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 05984bae..51d6be3f 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -33,6 +33,16 @@ jobs: echo "pin_tag=$PIN_TAG" >> $GITHUB_OUTPUT echo "Version: $VERSION" echo "version=$VERSION" >> $GITHUB_OUTPUT + echo "GH Workflow: ${{ github.workflow }}" + echo "GH Repository Owner: ${{ github.repository_owner }}" + + - name: Authenticate with GitHub NuGet Registry + run: | + dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \ + --name sails-github + --username "${{ github.workflow }}" + --password ${{ secrets.GITHUB_TOKEN }} + --store-password-in-clear-text build_win_x64: name: Build Native Libraries for Win x64 From 014ec34555ca9dbeb8ee97dddf47f042cdbcc57e Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 13:47:54 +0000 Subject: [PATCH 11/21] fix --- .github/workflows/net-release.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 51d6be3f..48308382 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -39,9 +39,9 @@ jobs: - name: Authenticate with GitHub NuGet Registry run: | dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \ - --name sails-github - --username "${{ github.workflow }}" - --password ${{ secrets.GITHUB_TOKEN }} + --name sails-github \ + --username "${{ github.workflow }}" \ + --password ${{ secrets.GITHUB_TOKEN }} \ --store-password-in-clear-text build_win_x64: From 26f6baf196d5aec7b0239c56dabed21e51385743 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 14:09:09 +0000 Subject: [PATCH 12/21] publish nugets --- .github/workflows/net-release.yml | 19 ++++++++++--------- 1 file changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 48308382..f0ee6333 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -17,6 +17,7 @@ jobs: outputs: r_version: ${{ steps.release_info.outputs.version }} r_tag: rs/v${{ steps.release_info.outputs.version }} + nuget_source_url: ${{ steps.release_info.outputs.nuget_source_url }} steps: - name: Extract Release Info @@ -29,17 +30,18 @@ jobs: echo "'$VERSION' is not a valid semver version" exit 1 fi + NUGET_SOURCE_URL="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" echo "Pin Tag: $PIN_TAG" echo "pin_tag=$PIN_TAG" >> $GITHUB_OUTPUT echo "Version: $VERSION" echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "GH Workflow: ${{ github.workflow }}" - echo "GH Repository Owner: ${{ github.repository_owner }}" + echo "NuGet Source URL: $NUGET_SOURCE_URL" + echo "nuget_source_url=$NUGET_SOURCE_URL" >> $GITHUB_OUTPUT - name: Authenticate with GitHub NuGet Registry run: | - dotnet nuget add source https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json \ - --name sails-github \ + dotnet nuget add source ${{ steps.release_info.outputs.nuget_source_url }} \ + --name ${{ github.repository_owner }}-github \ --username "${{ github.workflow }}" \ --password ${{ secrets.GITHUB_TOKEN }} \ --store-password-in-clear-text @@ -176,8 +178,7 @@ jobs: -p:RepositoryUrl=${{ github.server_url }}/${{ github.repository }} \ -p:Authors=Gear - - name: Upload NuGet Packages - uses: actions/upload-artifact@v4 - with: - name: nuget_packages - path: ./nugets + - name: Publish NuGet Packages + run: | + dotnet nuget push ./nugets/*.nupkg \ + --source ${{ needs.prepare.outputs.nuget_source_url }} From 0faddc212688c825ce740c51ddb27ea0ae4e658a Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 14:26:40 +0000 Subject: [PATCH 13/21] try gh token as nuget api key --- .github/workflows/net-release.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index f0ee6333..c4ae31b1 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -182,3 +182,4 @@ jobs: run: | dotnet nuget push ./nugets/*.nupkg \ --source ${{ needs.prepare.outputs.nuget_source_url }} + --api-key ${{ secrets.GITHUB_TOKEN }} From 603e707bdce49ddb189aecead50305b332ca116c Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 16:40:41 +0000 Subject: [PATCH 14/21] test beta version --- .github/workflows/net-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index c4ae31b1..fdaa05d4 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -26,7 +26,7 @@ jobs: PIN_TAG=${GITHUB_REF#refs/tags/} VERSION=${PIN_TAG#net/v} VERSION="${VERSION%-pin}" - if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+$ ]]; then + if [[ ! $VERSION =~ ^[0-9]+\.[0-9]+\.[0-9]+(-[a-z]+\.[0-9]+)?$ ]]; then echo "'$VERSION' is not a valid semver version" exit 1 fi @@ -37,6 +37,7 @@ jobs: echo "version=$VERSION" >> $GITHUB_OUTPUT echo "NuGet Source URL: $NUGET_SOURCE_URL" echo "nuget_source_url=$NUGET_SOURCE_URL" >> $GITHUB_OUTPUT + exit 1 - name: Authenticate with GitHub NuGet Registry run: | From 040b4ad9640e461e14db70b0efda5580c66dc3ef Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Fri, 22 Nov 2024 16:53:22 +0000 Subject: [PATCH 15/21] yet another publish --- .github/workflows/net-release.yml | 22 +++++++--------------- 1 file changed, 7 insertions(+), 15 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index fdaa05d4..b85063c8 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -17,7 +17,6 @@ jobs: outputs: r_version: ${{ steps.release_info.outputs.version }} r_tag: rs/v${{ steps.release_info.outputs.version }} - nuget_source_url: ${{ steps.release_info.outputs.nuget_source_url }} steps: - name: Extract Release Info @@ -30,22 +29,10 @@ jobs: echo "'$VERSION' is not a valid semver version" exit 1 fi - NUGET_SOURCE_URL="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" echo "Pin Tag: $PIN_TAG" echo "pin_tag=$PIN_TAG" >> $GITHUB_OUTPUT echo "Version: $VERSION" echo "version=$VERSION" >> $GITHUB_OUTPUT - echo "NuGet Source URL: $NUGET_SOURCE_URL" - echo "nuget_source_url=$NUGET_SOURCE_URL" >> $GITHUB_OUTPUT - exit 1 - - - name: Authenticate with GitHub NuGet Registry - run: | - dotnet nuget add source ${{ steps.release_info.outputs.nuget_source_url }} \ - --name ${{ github.repository_owner }}-github \ - --username "${{ github.workflow }}" \ - --password ${{ secrets.GITHUB_TOKEN }} \ - --store-password-in-clear-text build_win_x64: name: Build Native Libraries for Win x64 @@ -181,6 +168,11 @@ jobs: - name: Publish NuGet Packages run: | + NUGET_SOURCE_URL="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" + dotnet nuget add source $NUGET_SOURCE_URL \ + --name ${{ github.repository_owner }}-github \ + --username "${{ github.workflow }}" \ + --password ${{ secrets.GITHUB_TOKEN }} \ + --store-password-in-clear-text dotnet nuget push ./nugets/*.nupkg \ - --source ${{ needs.prepare.outputs.nuget_source_url }} - --api-key ${{ secrets.GITHUB_TOKEN }} + --source $NUGET_SOURCE_URL From 23cb056b019f856a6063ef6b54c81eb09a5c85ef Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Tue, 26 Nov 2024 16:49:35 +0000 Subject: [PATCH 16/21] fix nuget sources setup --- .github/workflows/net-ci.yml | 5 ++++- .github/workflows/net-release.yml | 16 ++++++++++------ 2 files changed, 14 insertions(+), 7 deletions(-) diff --git a/.github/workflows/net-ci.yml b/.github/workflows/net-ci.yml index d5386740..163acae0 100644 --- a/.github/workflows/net-ci.yml +++ b/.github/workflows/net-ci.yml @@ -34,7 +34,7 @@ jobs: with: dotnet-version: 8.0.x - - name: Restore Solution + - 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 @@ -43,6 +43,9 @@ jobs: --username "${{ github.workflow }}" \ --password ${{ secrets.GITHUB_TOKEN }} \ --store-password-in-clear-text + + - name: Restore Solution + run: | dotnet restore - name: Build Solution diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index b85063c8..5bdc53e6 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -145,6 +145,16 @@ jobs: 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 @@ -168,11 +178,5 @@ jobs: - name: Publish NuGet Packages run: | - NUGET_SOURCE_URL="https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" - dotnet nuget add source $NUGET_SOURCE_URL \ - --name ${{ github.repository_owner }}-github \ - --username "${{ github.workflow }}" \ - --password ${{ secrets.GITHUB_TOKEN }} \ - --store-password-in-clear-text dotnet nuget push ./nugets/*.nupkg \ --source $NUGET_SOURCE_URL From a9d36cb3a2703be5958679026f2653757ffa7647 Mon Sep 17 00:00:00 2001 From: Dennis Dyatlov Date: Tue, 26 Nov 2024 17:00:22 +0000 Subject: [PATCH 17/21] fix env var --- .github/workflows/net-release.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 5bdc53e6..75bc3d99 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -133,6 +133,8 @@ jobs: - build_osx_x64 - build_osx_arm64 runs-on: ubuntu-latest + env: + NUGET_SOURCE_URL: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" steps: - name: Checkout Code @@ -147,7 +149,6 @@ jobs: - 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 \ From 8a6e0f4f81c402c01b14ba11c62afd5a43caf47c Mon Sep 17 00:00:00 2001 From: Dennis Diatlov Date: Wed, 27 Nov 2024 13:07:57 +0000 Subject: [PATCH 18/21] create release for .net --- .github/workflows/net-release.yml | 48 ++++++++++++++++++++++++++++++- 1 file changed, 47 insertions(+), 1 deletion(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 75bc3d99..ece23dff 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -5,6 +5,11 @@ on: tags: - 'net/v*-pin' +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 @@ -16,7 +21,8 @@ jobs: shell: bash outputs: r_version: ${{ steps.release_info.outputs.version }} - r_tag: rs/v${{ steps.release_info.outputs.version }} + r_tag: net/v${{ steps.release_info.outputs.version }} + pin_tag: ${{ steps.release_info.outputs.pin_tag }} steps: - name: Extract Release Info @@ -178,6 +184,46 @@ jobs: -p:Authors=Gear - name: Publish NuGet Packages + if: false run: | dotnet nuget push ./nugets/*.nupkg \ --source $NUGET_SOURCE_URL + + release: + 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 Release Tag + run: | + R_TAG=${{ needs.prepare.outputs.r_tag }} + git config user.name "$GITHUB_USER_NAME" + git config user.email "$GITHUB_USER_EMAIL" + git tag -a "$R_TAG" -m "Release .Net v${{ needs.prepare.outputs.r_version }}" + git push origin "$R_TAG" + git push origin --delete "${{ needs.prepare.outputs.pin_tag }}" + + - 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 }} From d0a14a021b7dc7e5929881811667fc562c205bb5 Mon Sep 17 00:00:00 2001 From: Dennis Diatlov Date: Wed, 27 Nov 2024 13:37:57 +0000 Subject: [PATCH 19/21] re-enable NuGets publishing --- .github/workflows/net-release.yml | 1 - 1 file changed, 1 deletion(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index ece23dff..7ec87d42 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -184,7 +184,6 @@ jobs: -p:Authors=Gear - name: Publish NuGet Packages - if: false run: | dotnet nuget push ./nugets/*.nupkg \ --source $NUGET_SOURCE_URL From 36296ff495cc42bb2c8c6020b5aac29229129927 Mon Sep 17 00:00:00 2001 From: Dennis Diatlov Date: Wed, 27 Nov 2024 16:16:49 +0000 Subject: [PATCH 20/21] add publishing to NuGet.org --- .github/workflows/net-release.yml | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 7ec87d42..25714bb0 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -183,10 +183,16 @@ jobs: -p:RepositoryUrl=${{ github.server_url }}/${{ github.repository }} \ -p:Authors=Gear - - name: Publish NuGet Packages + # - name: Publish NuGet Packages + # run: | + # dotnet nuget push ./nugets/*.nupkg \ + # --source $NUGET_SOURCE_URL + + - name: Publish NuGet Packages to NuGet.org run: | dotnet nuget push ./nugets/*.nupkg \ - --source $NUGET_SOURCE_URL + --source https://api.nuget.org/v3/index.json \ + --api-key ${{ secrets.NUGET_ORG_API_KEY }} release: name: Create Release From be5f11885a1b40d1824b85f54d02380583d7b7fa Mon Sep 17 00:00:00 2001 From: Dennis Diatlov Date: Wed, 27 Nov 2024 16:56:18 +0000 Subject: [PATCH 21/21] final version --- .github/workflows/net-release.yml | 16 ---------------- 1 file changed, 16 deletions(-) diff --git a/.github/workflows/net-release.yml b/.github/workflows/net-release.yml index 25714bb0..3e06f039 100644 --- a/.github/workflows/net-release.yml +++ b/.github/workflows/net-release.yml @@ -139,8 +139,6 @@ jobs: - build_osx_x64 - build_osx_arm64 runs-on: ubuntu-latest - env: - NUGET_SOURCE_URL: "https://nuget.pkg.github.com/${{ github.repository_owner }}/index.json" steps: - name: Checkout Code @@ -153,15 +151,6 @@ jobs: pattern: native_client_gen_* merge-multiple: true - - name: Set Up NuGet Sources - run: | - 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 @@ -183,11 +172,6 @@ jobs: -p:RepositoryUrl=${{ github.server_url }}/${{ github.repository }} \ -p:Authors=Gear - # - name: Publish NuGet Packages - # run: | - # dotnet nuget push ./nugets/*.nupkg \ - # --source $NUGET_SOURCE_URL - - name: Publish NuGet Packages to NuGet.org run: | dotnet nuget push ./nugets/*.nupkg \