-
Notifications
You must be signed in to change notification settings - Fork 27
94 lines (86 loc) · 2.98 KB
/
dispatched-build.yml
File metadata and controls
94 lines (86 loc) · 2.98 KB
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
name: 🏗 Build on dispatch
run-name: Build DO on dispatch (run by ${{ github.actor }}) Run No ${{ github.run_number }} in ${{ inputs.buildConfiguration }} config.
on:
workflow_dispatch:
inputs:
buildConfiguration:
description: 'Build configuration'
required: true
default: 'Release'
type: choice
options:
- Debug
- Release
verbosity:
description: 'dotnet build verbosity'
required: false
default: 'minimal'
type: choice
options:
- quiet
- minimal
- normal
- detailed
- diagnostic
specific_sha:
description: 'Commit SHA to checkout(optional)'
required: false
default: ''
type: string
publish_artifacts:
description: 'Publish artifacts'
required: true
default: false
type: boolean
# new commits with the same key will cancel previously run workflows
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
permissions:
contents: read
jobs:
build:
name: Build
runs-on: ubuntu-latest
env:
BUILD_CONFIG: ${{ inputs.buildConfiguration }}
BUILD_NUMBER: ${{ github.run_number }}
steps:
- name: Checkout repo (last commit)
if: ${{ inputs.specific_sha == '' || github.reg_type != 'branch' }}
timeout-minutes: 1
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
- name: Checkout repo (last 50 commit)
if: ${{ inputs.specific_sha != '' && github.reg_type == 'branch' }}
timeout-minutes: 1
uses: actions/checkout@v4
with:
ref: ${{ github.ref_name }}
fetch-depth: 50
# it leads to detached HEAD, but we don't commit anything anyway
- name: Manual commit checkout if required
if: ${{ inputs.specific_sha != '' && github.reg_type == 'branch' }}
run: git checkout ${{ inputs.specific_sha }}
- name: Build Orm
if: ${{ success() }}
run: dotnet build Orm.sln --configuration $BUILD_CONFIG -v ${{ inputs.verbosity }}
- name: Organize files
if: ${{ success() && inputs.buildConfiguration == 'Release' && inputs.publish_artifacts }}
run: |
mkdir -p _Build/bin/Release/Binaries
mkdir -p _Build/bin/Release/Dist
cp -r _Build/bin/Release/lib _Build/bin/Release/Binaries/
cp -r _Build/bin/Release/tools _Build/bin/Release/Binaries/
cp -r _Build/bin/Release/packages _Build/bin/Release/Dist/
- name: Publish artifacts
if: ${{ success() && inputs.buildConfiguration == 'Release' && inputs.publish_artifacts }}
uses: actions/upload-artifact@v4
with:
name: DO_${{ github.ref_name }}_${{ github.run_number }}
path: |
_Build/bin/Release/Binaries/**
_Build/bin/Release/Dist/**
if-no-files-found: error
retention-days: 1