Skip to content

Commit 6e6fc35

Browse files
committed
dsfw
1 parent 8b690fa commit 6e6fc35

File tree

3 files changed

+36
-12
lines changed

3 files changed

+36
-12
lines changed

.editorconfig

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Remove the line below if you want to inherit .editorconfig settings from higher directories
22
root = true
33

4+
# All files
5+
[*]
6+
end_of_line = lf
7+
insert_final_newline = true
8+
49
# C# files
510
[*.cs]
611

.github/workflows/promote-branch.yml

Lines changed: 28 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ on:
66
promotion-type:
77
type: choice
88
options:
9-
- 'release'
109
- 'preview'
11-
description: 'Target branch to create.'
10+
- 'release'
11+
description: 'Promotion type.'
1212
required: true
1313

1414
permissions:
@@ -26,19 +26,37 @@ env:
2626
is-maintenance-branch: ${{ startsWith(github.ref_name, 'support') }}
2727

2828
jobs:
29+
versioning:
30+
name: 'Determine assembly version'
31+
uses: ./.github/workflows/determine-version.yml
32+
with:
33+
config-file-path: './.gitversion/version.yml'
34+
run-number: ${{ github.run-number }}
2935
validate-promotion:
3036
name: 'Validate promotion'
37+
needs: [versioning]
3138
runs-on: ubuntu-latest
3239
steps:
40+
- name: 'Checkout ${{ github.head_ref || github.ref }}'
41+
uses: actions/checkout@v4
3342
- name: 'Check promotion type'
43+
if: ${{ (inputs.promotion-type != 'release') && (inputs.promotion-type != 'preview') }}
3444
run: |
35-
if [[ "${{ inputs.promotion-type }}" != "release" && "${{ inputs.promotion-type }}" != "preview" ]]; then
36-
echo "Invalid promotion type: ${{ inputs.promotion-type }}"
37-
exit 1
38-
fi
45+
echo "Invalid promotion type: ${{ inputs.promotion-type }}"
46+
exit 1
3947
- name: 'Check source branch'
48+
if: ${{ (env.isdevelopment-branch == 'false') && (env.is-maintenance-branch == 'false') }}
4049
run: |
41-
if [[ "!${{ env.isdevelopment-branch }} || !${{ env.is-maintenance-branch }}" ]]; then
42-
echo "Source branch is required."
43-
exit 1
44-
fi
50+
echo "Invalid source branch: ${{ github.ref_name }}"
51+
exit 1
52+
- name: 'Validate target branch'
53+
run: |
54+
if [[ "${{ inputs.promotion-type }}" == "preview" ]]; then
55+
echo "target-branch=preview/${{ needs.versioning.outputs.friendly-version }}" >> $GITHUB_ENV
56+
else
57+
echo "target-branch=release/${{ needs.versioning.outputs.friendly-version }}" >> $GITHUB_ENV
58+
fi
59+
60+
echo "Target branch: ${{ env.target-branch }}"
61+
62+
git ls-remote --exit-code --heads origin ${{ env.target-branch }}

.gitversion/version.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@ version-in-branch-pattern: (?<version>[vV]?\d+.\d+(\.\d+){0,1})
66
update-build-number: false
77
semantic-version-format: Loose
88
strategies:
9-
- TrackReleaseBranches
109
- VersionInBranchName
10+
- TrackReleaseBranches
1111
- Fallback
1212
ignore:
1313
sha: []
@@ -42,6 +42,7 @@ branches:
4242
tracks-release-branches: true
4343
source-branches:
4444
- feature
45+
- main
4546
preview:
4647
mode: ManualDeployment
4748
label: 'preview'
@@ -119,4 +120,4 @@ branches:
119120
- hotfix
120121
- bugfix
121122
- support
122-
- feature
123+
- feature

0 commit comments

Comments
 (0)