Skip to content

Commit

Permalink
V15/actions (#705)
Browse files Browse the repository at this point in the history
* test gitversion action

* update gitversion config.

* version

* downgrade gitversion

* add pr - check build. (doesn't package)

* fix indentation

* remove job dependency

* package build test.

* Change branches for action builds
  • Loading branch information
KevinJump authored Feb 12, 2025
1 parent 04919bd commit 9eb8d84
Show file tree
Hide file tree
Showing 3 changed files with 76 additions and 152 deletions.
73 changes: 1 addition & 72 deletions .github/workflows/dotnet-build.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,6 @@
name: dotnet core build
name: PR Project Build and Test

on:
push:
branches: [v15/main]
pull_request:
branches: [v15/main]

Expand All @@ -11,39 +9,9 @@ env:
out_folder: ./build-out/

jobs:
version:
runs-on: windows-latest
outputs:
version_string: ${{ steps.gitversion.outputs.fullSemVer }}

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install GitVersion

uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "6.x"

- name: Determine Version with GitVersion (MSBuild in Proj will do this)
id: gitversion
uses: gittools/actions/gitversion/[email protected]
with:
useConfigFile: true
configFilePath: ./GitVersion.yml

- name: Display version
run: |
echo "Full Version: ${{ steps.gitversion.outputs.fullSemVer }}"
build-project:
runs-on: windows-latest

needs: version

env:
solution_name: ./uSync.sln
test_project: ./uSync.Tests/uSync.tests.csproj
Expand Down Expand Up @@ -71,42 +39,3 @@ jobs:

- name: Generate AppSettings Schema
run: dotnet run -c ${{env.Config}} --project ${{ env.schema_gen_project}}

- name: Stamp version on package
working-directory: ./uSync.Backoffice.Management.Client/usync-assets
run: npm version ${{ needs.version.outputs.version_string }}

package-up:
runs-on: windows-latest

needs: [build-project, version]

strategy:
matrix:
package:
- uSync.Core
- uSync.Backoffice
- uSync.Backoffice.Management.Api
- uSync.Backoffice.Management.Client
- uSync.Backoffice.Targets
- uSync.Community.Contrib
- uSync.Community.DataTypeSerializers

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: version
run: |
echo "Version: ${{ needs.version.outputs.version_string}}"
- name: package ${{ matrix.package }}
run: dotnet pack ./${{ matrix.package }}/${{ matrix.package }}.csproj --no-restore -c ${{env.config}} --output ${{env.out_folder}} /p:version=${{ needs.version.outputs.version_string }}

- name: Upload nuget file as build artifact
uses: actions/upload-artifact@v4
with:
name: Nuget Build Output
path: ${{env.OUT_FOLDER}}
153 changes: 74 additions & 79 deletions .github/workflows/package-build.yml
Original file line number Diff line number Diff line change
@@ -1,122 +1,117 @@
name: Package up.
name: Build and Package.

on:
push:
branches: "v14/main"
branches: [v15/main]

env:
config: Release
out_folder: ./build-out/

jobs:
build:
version:
runs-on: windows-latest

env:
CONFIG: "Release"
SOLUTION_FILE: "./uSyncBuild.sln"
OUT_FOLDER: "./build.out/"
outputs:
version_string: ${{ steps.gitversion.outputs.fullSemVer }}

steps:
- name: Setup dotnet
uses: actions/setup-dotnet@v3
- name: Checkout
uses: actions/checkout@v4
with:
dotnet-version: "8.x"
fetch-depth: 0

- name: Install GitVersion
uses: gittools/actions/gitversion/[email protected]
with:
versionSpec: "5.x"

- name: Checkout
uses: actions/checkout@v3
uses: gittools/actions/gitversion/setup@v3
with:
fetch-depth: 0
versionSpec: "5.x"

- name: Determine Version with GitVersion (MSBuild in Proj will do this)
id: gitversion
uses: gittools/actions/gitversion/execute@v0.9.15
uses: gittools/actions/gitversion/execute@v3
with:
useConfigFile: true
configFilePath: ./GitVersion.yml

# - name: Restore npm
# uses: actions/setup-node@v3
# with:
# node-version: "20.x"
# cache: "npm"
# - run: npm install

- name: install typescript
run: npm install -g typescript
- name: Display version
run: |
echo "Full Version: ${{ steps.gitversion.outputs.fullSemVer }}"
# install and run the packages for our assets folder.
- name: install Management client
run: npm run install-client
build-project:
runs-on: windows-latest

- name: build management client
run: npm run build-client
needs: version

- name: Display GitVersion SemVer
run: |
echo "FullSemVer: ${{ steps.gitversion.outputs.fullSemVer }}"
env:
solution_name: ./uSync.sln
test_project: ./uSync.Tests/uSync.tests.csproj
schema_gen_project: ./uSync.SchemaGenerator/uSync.SchemaGenerator.csproj

# ------------------------
# actual builds / packages
# ------------------------
steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

# use nuget cache.
- uses: actions/cache@v3
- name: Install .Net core
uses: actions/setup-dotnet@v4
with:
path: ~/.nuget/packages
key: ${{ runner.os }}-nuget-${{ hashfiles('**/*.csproj') }}
restore-keys: |
${{ runner.os }}-nuget
dotnet-version: 9.0.x

- name: restore
run: dotnet restore ${{ env.solution_name}}

- name: Restore Dependencies
run: dotnet restore ./uSync/uSync.csproj
- name: build
run: dotnet build ${{ env.solution_name }} -c ${{ env.config }} -p:ContinuousIntegrationBuild=true

- name: tests
run: dotnet test ./uSync.Tests/uSync.Tests.csproj
- name: test
run: dotnet test ${{ env.solution_name }}

- name: Generate AppSettings Schema
run: dotnet run -c ${{env.Config}} --project ./uSync.SchemaGenerator/uSync.SchemaGenerator.csproj
run: dotnet run -c ${{env.Config}} --project ${{ env.schema_gen_project}}

package-up:
runs-on: windows-latest

needs: [build-project, version]

steps:
- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Build uSync.Core
run: dotnet pack ./uSync.Core/uSync.Core.csproj --no-restore -c ${{env.CONFIG}} --output ${{env.OUT_FOLDER}} /p:version=${{steps.gitversion.outputs.fullSemVer}}
- name: version
run: |
echo "Version: ${{ needs.version.outputs.version_string}}"
- name: Stamp version on NPM Package
working-directory: ./uSync.Backoffice.Management.Client/usync-assets
run: npm version ${{ needs.version.outputs.version_string }}

- name: Build uSync.Community.Contrib
run: dotnet pack ./uSync.Community.Contrib/uSync.Community.Contrib.csproj --no-restore -c ${{env.CONFIG}} --output ${{env.OUT_FOLDER}} /p:version=${{steps.gitversion.outputs.fullSemVer}}
- name: package uSync.Core
run: dotnet pack ./uSync.Core/uSync.Core.csproj -c ${{env.config}} --output ${{env.out_folder}} /p:version=${{ needs.version.outputs.version_string }}

- name: Build uSync.DataTypeSerializers
run: dotnet pack ./uSync.Community.DataTypeSerializers/uSync.Community.DataTypeSerializers.csproj -c ${{env.CONFIG}} --output ${{env.OUT_FOLDER}} /p:version=${{steps.gitversion.outputs.fullSemVer}}
- name: package uSync.Backoffice
run: dotnet pack ./uSync.Backoffice/uSync.Backoffice.csproj -c ${{env.config}} --output ${{env.out_folder}} /p:version=${{ needs.version.outputs.version_string }}

- name: Build uSync.BackOffice
run: dotnet pack ./uSync.BackOffice/uSync.BackOffice.csproj --no-restore -c ${{env.CONFIG}} --output ${{env.OUT_FOLDER}} /p:version=${{steps.gitversion.outputs.fullSemVer}}
- name: package uSync.Backoffice.Management.Api
run: dotnet pack ./uSync.Backoffice.Management.Api/uSync.Backoffice.Management.Api.csproj -c ${{env.config}} --output ${{env.out_folder}} /p:version=${{ needs.version.outputs.version_string }}

- name: Build uSync.Backoffice.Management.Api
run: dotnet pack ./uSync.BackOffice.Management.Api/uSync.BackOffice.Management.Api.csproj --no-restore -c ${{env.CONFIG}} --output ${{env.OUT_FOLDER}} /p:version=${{steps.gitversion.outputs.fullSemVer}}
- name: package uSync.Backoffice.Management.Client
run: dotnet pack ./uSync.Backoffice.Management.Client/uSync.Backoffice.Management.Client.csproj -c ${{env.config}} --output ${{env.out_folder}} /p:version=${{ needs.version.outputs.version_string }}

- name: Build uSync.Backoffice.Management.Client
run: dotnet pack ./uSync.BackOffice.Management.Client/uSync.BackOffice.Management.Client.csproj --no-restore -c ${{env.CONFIG}} --output ${{env.OUT_FOLDER}} /p:version=${{steps.gitversion.outputs.fullSemVer}}
- name: package uSync.Backoffice.Targets
run: dotnet pack ./uSync.Backoffice.Targets/uSync.Backoffice.Targets.csproj -c ${{env.config}} --output ${{env.out_folder}} /p:version=${{ needs.version.outputs.version_string }}

- name: Build uSync.BackOfficeTargets
run: dotnet pack ./uSync.BackOffice.Targets/uSync.BackOffice.Targets.csproj -c ${{env.CONFIG}} --output ${{env.OUT_FOLDER}} /p:version=${{steps.gitversion.outputs.fullSemVer}}
- name: package uSync.Community.Contrib
run: dotnet pack ./uSync.Community.Contrib/uSync.Community.Contrib.csproj -c ${{env.config}} --output ${{env.out_folder}} /p:version=${{ needs.version.outputs.version_string }}

- name: Build uSync
run: dotnet pack ./uSync/uSync.csproj --no-restore -c ${{env.CONFIG}} --output ${{env.OUT_FOLDER}} /p:version=${{steps.gitversion.outputs.fullSemVer}}
- name: package uSync.Community.DataTypeSerializers
run: dotnet pack ./uSync.Community.DataTypeSerializers/uSync.Community.DataTypeSerializers.csproj -c ${{env.config}} --output ${{env.out_folder}} /p:version=${{ needs.version.outputs.version_string }}

- name: Upload nuget file as build artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: Nuget Build Output
path: ${{env.OUT_FOLDER}}

# can't use wilecards with dotnet nuget command
- name: Push to Jumoo GitHub Nuget Repo
if: ${{ github.event_name != 'pull_request' }}
run: |
dotnet nuget push ./build.out/uSync.${{steps.gitversion.outputs.fullSemVer}}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/kevinjump/index.json --api-key ${{ github.token }}
dotnet nuget push ./build.out/uSync.Core.${{steps.gitversion.outputs.fullSemVer}}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/kevinjump/index.json --api-key ${{ github.token }}
dotnet nuget push ./build.out/uSync.BackOffice.${{steps.gitversion.outputs.fullSemVer}}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/kevinjump/index.json --api-key ${{ github.token }}
dotnet nuget push ./build.out/uSync.BackOffice.Management.Api.${{steps.gitversion.outputs.fullSemVer}}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/kevinjump/index.json --api-key ${{ github.token }}
dotnet nuget push ./build.out/uSync.BackOffice.Management.Client.${{steps.gitversion.outputs.fullSemVer}}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/kevinjump/index.json --api-key ${{ github.token }}
dotnet nuget push ./build.out/uSync.BackOffice.Targets.${{steps.gitversion.outputs.fullSemVer}}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/kevinjump/index.json --api-key ${{ github.token }}
dotnet nuget push ./build.out/uSync.Community.Contrib.${{steps.gitversion.outputs.fullSemVer}}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/kevinjump/index.json --api-key ${{ github.token }}
dotnet nuget push ./build.out/uSync.Community.DataTypeSerializers.${{steps.gitversion.outputs.fullSemVer}}.nupkg --skip-duplicate --source https://nuget.pkg.github.com/kevinjump/index.json --api-key ${{ github.token }}
2 changes: 1 addition & 1 deletion GitVersion.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ branches:
main:
mode: ContinuousDeployment
tag: ""
regex: ^v12\/main$
regex: ^v15\/main$
pull-request:
mode: ContinuousDeployment
ignore:
Expand Down

0 comments on commit 9eb8d84

Please sign in to comment.