Skip to content

Update change detection output handling and build/test conditions #49

Update change detection output handling and build/test conditions

Update change detection output handling and build/test conditions #49

Workflow file for this run

name: Main Workflow
on:
push:
branches:
- '**' # Matches all branches
pull_request:
jobs:
ci:
name: CI
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
change_detection: ${{ steps.change_detection.outputs }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: tools - detect changes
id: change_detection
uses: dorny/paths-filter@v3
with:
base: ${{ github.ref }}
filters: |
src:
- 'src/**'
- 'ES.FX.sln'
- 'Directory.Build.props'
tests:
- 'tests/**'
playground:
- 'playground/**'
- name: build
if: ${{ steps.change_detection.outputs.changes != '[]' }}
uses: ./.github/actions/build
with:
configuration: Debug
useVersioning: false
- name: test
if: ${{ steps.change_detection.outputs.changes != '[]' }}
uses: ./.github/actions/test
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: checkout
uses: actions/checkout@v4
with:
fetch-depth: 0
- name: build
uses: ./.github/actions/build
with:
configuration: Release
useVersioning: true
- name: artifacts - nuget - gather
run: |
mkdir -p .artifacts/nuget
find . -name "*.nupkg" -exec cp {} .artifacts/nuget/ \;
- name: artifacts - nuget - upload
uses: actions/upload-artifact@v4
with:
name: artifacts-nuget
path: .artifacts/nuget/*.nupkg
- name: git - tag
if: >
github.ref == 'refs/heads/main' ||
startsWith(github.ref, 'refs/heads/release/') ||
startsWith(github.ref, 'refs/heads/hotfix/')
run: |
git config --global user.name 'github-actions'
git config --global user.email '[email protected]'
git tag ${{env.GitVersion_SemVer}}
git push origin ${{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