-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
f784dce
commit 2e62bc2
Showing
1 changed file
with
159 additions
and
59 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -15,8 +15,8 @@ jobs: | |
id-token: write | ||
contents: read | ||
checks: write | ||
outputs: | ||
change_detection_src: ${{ steps.change_detection.outputs.src }} | ||
env: | ||
requires_build: false | ||
steps: | ||
|
||
- name: checkout | ||
|
@@ -45,8 +45,7 @@ jobs: | |
id: change_detection | ||
uses: dorny/paths-filter@v3 | ||
with: | ||
# base: ${{ github.ref }} | ||
base: ${{ steps.gitversion.outputs.VersionSourceSha }} | ||
base: ${{ github.ref }} | ||
filters: | | ||
src: | ||
- 'src/**' | ||
|
@@ -59,8 +58,15 @@ jobs: | |
- 'ES.FX.sln' | ||
- 'Directory.Build.props' | ||
- name: tools - evaluate build flag | ||
if: steps.change_detection.outputs.build == 'true' || | ||
github.event_name == 'pull_request' || | ||
(startsWith(github.ref, 'refs/heads/release/') && github.event_name == 'create') | ||
run: echo "requires_build=true" >> $GITHUB_ENV | ||
|
||
|
||
- name: cache - nuget | ||
if: ${{ steps.build_flag.outputs.build == 'true' }} | ||
if: ${{ env.requires_build == 'true' }} | ||
uses: actions/cache@v4 | ||
with: | ||
path: ~/.nuget/packages | ||
|
@@ -69,82 +75,176 @@ jobs: | |
${{ runner.os }}-nuget- | ||
- name: dotnet restore | ||
if: ${{ steps.build_flag.outputs.build == 'true' }} | ||
shell: bash | ||
if: ${{ env.requires_build == 'true' }} | ||
run: dotnet restore | ||
|
||
- name: dotnet build | ||
if: ${{ steps.build_flag.outputs.build == 'true' }} | ||
shell: bash | ||
if: ${{ env.requires_build == 'true' }} | ||
run: dotnet build --no-restore --configuration Release /p:Version=${{env.GitVersion_SemVer}} /p:AssemblyVersion=${{env.GitVersion_AssemblySemFileVer}} /p:NuGetVersion=${{env.GitVersion_SemVer}} | ||
|
||
- name: dotnet test | ||
if: ${{ steps.build_flag.outputs.build == 'true' }} | ||
shell: bash | ||
if: ${{ env.requires_build == 'true' }} | ||
run: dotnet test --no-build --configuration Release --verbosity normal | ||
|
||
- name: test-reporter | ||
uses: dorny/test-reporter@v1 | ||
if: ${{ steps.build_flag.outputs.build == 'true' }} | ||
if: ${{ env.requires_build == 'true' }} | ||
with: | ||
name: Test Results | ||
path: .artifacts/TestResults/*.trx | ||
reporter: dotnet-trx | ||
|
||
- name: artifacts - nuget - gather | ||
if: ${{ steps.build_flag.outputs.build == 'true' }} | ||
if: ${{ env.requires_build == 'true' }} | ||
run: | | ||
mkdir -p .artifacts/nuget | ||
find . -name "*.nupkg" -exec cp {} .artifacts/nuget/ \; | ||
- name: artifacts - nuget - upload | ||
if: ${{ steps.build_flag.outputs.build == 'true' }} | ||
if: ${{ env.requires_build == 'true' }} | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: artifacts-nuget | ||
path: .artifacts/nuget/*.nupkg | ||
|
||
cd: | ||
name: CD | ||
runs-on: ubuntu-latest | ||
needs: ci | ||
if: > | ||
needs.ci.outputs.change_detection_src == 'true' && | ||
github.event.workflow_run.conclusion == 'success' && | ||
github.event.workflow_run.event == 'push' && | ||
(github.ref == 'refs/heads/main' || | ||
github.ref == 'refs/heads/develop' || | ||
startsWith(github.ref, 'refs/heads/feature/') || | ||
startsWith(github.ref, 'refs/heads/release/') || | ||
startsWith(github.ref, 'refs/heads/hotfix/')) | ||
steps: | ||
|
||
- name: artifacts - nuget - download | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: artifacts-nuget | ||
path: .artifacts/nuget | ||
|
||
- name: checkout | ||
uses: actions/checkout@v4 | ||
with: | ||
fetch-depth: 0 | ||
|
||
- name: git - tag | ||
if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/') | ||
run: | | ||
git config --global user.name 'github-actions' | ||
git config --global user.email '[email protected]' | ||
git tag version/v${{env.GitVersion_SemVer}} | ||
git push version/origin v${{env.GitVersion_SemVer}} | ||
- name: dotnet nuget add source | ||
shell: bash | ||
run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/emberstack/index.json" | ||
|
||
- name: dotnet nuget push | ||
run: | | ||
for pkg in .artifacts/nuget/*.nupkg; do | ||
dotnet nuget push "$pkg" --source "github" --api-key ${{ secrets.ES_GITHUB_PAT }} | ||
done | ||
## ----------------------------------- | ||
# ci: | ||
# name: CI | ||
# runs-on: ubuntu-latest | ||
# permissions: | ||
# pull-requests: read | ||
# id-token: write | ||
# contents: read | ||
# checks: write | ||
# outputs: | ||
# change_detection_src: ${{ steps.change_detection.outputs.src }} | ||
# steps: | ||
|
||
# - name: checkout | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
|
||
# - name: tools - dotnet - install | ||
# uses: actions/setup-dotnet@v4 | ||
# with: | ||
# dotnet-version: '8.x' | ||
|
||
# - name: tools - gitversion - install | ||
# uses: gittools/actions/gitversion/[email protected] | ||
# with: | ||
# versionSpec: '5.x' | ||
# preferLatestVersion: true | ||
|
||
# - name: tools - gitversion - execute | ||
# uses: gittools/actions/gitversion/[email protected] | ||
# with: | ||
# useConfigFile: true | ||
# configFilePath: GitVersion.yaml | ||
|
||
# - name: tools - detect changes | ||
# id: change_detection | ||
# uses: dorny/paths-filter@v3 | ||
# with: | ||
# # base: ${{ github.ref }} | ||
# base: ${{ steps.gitversion.outputs.VersionSourceSha }} | ||
# filters: | | ||
# src: | ||
# - 'src/**' | ||
# - 'ES.FX.sln' | ||
# - 'Directory.Build.props' | ||
# build: | ||
# - 'src/**' | ||
# - 'playground/**' | ||
# - 'tests/**' | ||
# - 'ES.FX.sln' | ||
# - 'Directory.Build.props' | ||
|
||
# - name: cache - nuget | ||
# if: ${{ env.requires_build == 'true' }} | ||
# uses: actions/cache@v4 | ||
# with: | ||
# path: ~/.nuget/packages | ||
# key: ${{ runner.os }}-nuget-${{ hashFiles('**/*.csproj') }} | ||
# restore-keys: | | ||
# ${{ runner.os }}-nuget- | ||
|
||
# - name: dotnet restore | ||
# if: ${{ env.requires_build == 'true' }} | ||
# | ||
# run: dotnet restore | ||
|
||
# - name: dotnet build | ||
# if: ${{ env.requires_build == 'true' }} | ||
# | ||
# run: dotnet build --no-restore --configuration Release /p:Version=${{env.GitVersion_SemVer}} /p:AssemblyVersion=${{env.GitVersion_AssemblySemFileVer}} /p:NuGetVersion=${{env.GitVersion_SemVer}} | ||
|
||
# - name: dotnet test | ||
# if: ${{ env.requires_build == 'true' }} | ||
# | ||
# run: dotnet test --no-build --configuration Release --verbosity normal | ||
|
||
# - name: test-reporter | ||
# uses: dorny/test-reporter@v1 | ||
# if: ${{ env.requires_build == 'true' }} | ||
# with: | ||
# name: Test Results | ||
# path: .artifacts/TestResults/*.trx | ||
# reporter: dotnet-trx | ||
|
||
# - name: artifacts - nuget - gather | ||
# if: ${{ env.requires_build == 'true' }} | ||
# run: | | ||
# mkdir -p .artifacts/nuget | ||
# find . -name "*.nupkg" -exec cp {} .artifacts/nuget/ \; | ||
|
||
# - name: artifacts - nuget - upload | ||
# if: ${{ env.requires_build == 'true' }} | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: artifacts-nuget | ||
# path: .artifacts/nuget/*.nupkg | ||
|
||
# cd: | ||
# name: CD | ||
# runs-on: ubuntu-latest | ||
# needs: ci | ||
# if: > | ||
# needs.ci.outputs.change_detection_src == 'true' && | ||
# github.event.workflow_run.conclusion == 'success' && | ||
# github.event.workflow_run.event == 'push' && | ||
# (github.ref == 'refs/heads/main' || | ||
# github.ref == 'refs/heads/develop' || | ||
# startsWith(github.ref, 'refs/heads/feature/') || | ||
# startsWith(github.ref, 'refs/heads/release/') || | ||
# startsWith(github.ref, 'refs/heads/hotfix/')) | ||
|
||
# steps: | ||
|
||
# - name: artifacts - nuget - download | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: artifacts-nuget | ||
# path: .artifacts/nuget | ||
|
||
# - name: checkout | ||
# uses: actions/checkout@v4 | ||
# with: | ||
# fetch-depth: 0 | ||
|
||
# - name: git - tag | ||
# if: github.ref == 'refs/heads/main' || github.ref == 'refs/heads/develop' || startsWith(github.ref, 'refs/heads/release/') | ||
# run: | | ||
# git config --global user.name 'github-actions' | ||
# git config --global user.email '[email protected]' | ||
# git tag version/v${{env.GitVersion_SemVer}} | ||
# git push version/origin v${{env.GitVersion_SemVer}} | ||
|
||
# - name: dotnet nuget add source | ||
# | ||
# run: dotnet nuget add source --username USERNAME --password ${{ secrets.GITHUB_TOKEN }} --store-password-in-clear-text --name github "https://nuget.pkg.github.com/emberstack/index.json" | ||
|
||
# - name: dotnet nuget push | ||
# run: | | ||
# for pkg in .artifacts/nuget/*.nupkg; do | ||
# dotnet nuget push "$pkg" --source "github" --api-key ${{ secrets.ES_GITHUB_PAT }} | ||
# done |