-
Notifications
You must be signed in to change notification settings - Fork 1
103 lines (90 loc) · 2.88 KB
/
main.yaml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
name: Main Workflow
on:
push:
branches:
- '**' # Matches all branches
pull_request:
jobs:
ci:
name: CI
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
src_changed: ${{ steps.src_changed.outputs.changes }}
steps:
- name: checkout
uses: actions/checkout@v4
with:
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
runs-on: ubuntu-latest
needs: ci
if: >
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/'))
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