Skip to content

Commit

Permalink
devops: rework CI and CD to use source change detection
Browse files Browse the repository at this point in the history
  • Loading branch information
winromulus committed Jun 15, 2024
1 parent c3ea722 commit 96c29e3
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 40 deletions.
43 changes: 27 additions & 16 deletions .github/workflows/main.yaml
Original file line number Diff line number Diff line change
@@ -1,47 +1,61 @@
name: Main
name: Main Workflow

on:
push:
branches:
- '**' # Matches all branches
pull_request:

jobs:
ci:
name: CI
runs-on: ubuntu-latest
outputs:
src_changed: ${{ steps.src_changed.outputs.changes }}
steps:

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

- name: src - identify source changes
id: src_changed
uses: dorny/paths-filter@v3
with:
base: ${{ github.ref }}
filters: |
src:
- 'src/**'
solution:
- 'ES.FX.sln'
build:
- 'Directory.Build.props'
- name: build
uses: ./.github/actions/build
if: steps.src_changed.outputs.src == 'true'
with:
configuration: Debug
useVersioning: false

- name: test
if: steps.src_changed.outputs.src == 'true'
uses: ./.github/actions/test

cd:
name: CD
needs: ci
runs-on: ubuntu-latest
needs: ci
if: >
(
contains(toJson(github.event.commits), 'src/') ||
contains(toJson(github.event.commits), 'ES.FX.sln') ||
contains(toJson(github.event.commits), 'Directory.Build.props')
) && (
github.ref == 'refs/heads/main' ||
needs.ci.outputs.src_changed == '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/')
)
startsWith(github.ref, 'refs/heads/hotfix/'))
steps:
- name: checkout
uses: actions/checkout@v4
Expand Down Expand Up @@ -79,12 +93,9 @@ jobs:
- 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
24 changes: 0 additions & 24 deletions .github/workflows/pr.yaml

This file was deleted.

0 comments on commit 96c29e3

Please sign in to comment.