Skip to content

Commit e2dc93b

Browse files
add tag override
1 parent 3a6c226 commit e2dc93b

File tree

5 files changed

+94
-14
lines changed

5 files changed

+94
-14
lines changed

.github/workflow-gen/Program.cs

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
// Copyright (c) Duende Software. All rights reserved.
1+
// Copyright (c) Duende Software. All rights reserved.
22
// Licensed under the Apache License, Version 2.0. See LICENSE in the project root for license information.
33

44
using Logicality.GitHub.Actions.Workflow;
@@ -110,8 +110,9 @@ void GenerateReleaseWorkflow(Component component)
110110
workflow.On
111111
.WorkflowDispatch()
112112
.Inputs(
113-
new StringInput("version", "Version in format X.Y.Z or X.Y.Z-preview.", true, "0.0.0")
114-
, new StringInput("target-branch", "(Optional) the name of the branch to release from", false, "main"));
113+
new StringInput("version", "Version in format X.Y.Z or X.Y.Z-preview.", true, "0.0.0"),
114+
new StringInput("branch", "(Optional) the name of the branch to release from", false, "main"),
115+
new BooleanInput("remove-tag-if-exists", "If set, will remove the existing tag. Use this if you have issues with the previous release action", false, false));
115116

116117
workflow.EnvDefaults();
117118

@@ -132,11 +133,26 @@ void GenerateReleaseWorkflow(Component component)
132133

133134
tagJob.StepSetupDotNet();
134135

136+
137+
tagJob.Step()
138+
.Name("Git Config")
139+
.Run(@"git config --global user.email ""github-bot@duendesoftware.com""
140+
git config --global user.name ""Duende Software GitHub Bot""");
141+
142+
tagJob.Step()
143+
.Name("Remove previous git tag")
144+
.If("github.event.inputs['remove-tag-if-exists'] == 'true'")
145+
.Run($@"if git rev-parse {component.TagPrefix}-{contexts.Event.Input.Version} >/dev/null 2>&1; then
146+
git tag -d {component.TagPrefix}-{contexts.Event.Input.Version}
147+
git push --delete origin {component.TagPrefix}-{contexts.Event.Input.Version}
148+
else
149+
echo 'Tag {component.TagPrefix}-{contexts.Event.Input.Version} does not exist.'
150+
fi");
151+
152+
135153
tagJob.Step()
136154
.Name("Git tag")
137-
.Run($@"git config --global user.email ""github-bot@duendesoftware.com""
138-
git config --global user.name ""Duende Software GitHub Bot""
139-
git tag -a {component.TagPrefix}-{contexts.Event.Input.Version} -m ""Release v{contexts.Event.Input.Version}""
155+
.Run($@"git tag -a {component.TagPrefix}-{contexts.Event.Input.Version} -m ""Release v{contexts.Event.Input.Version}""
140156
git push origin {component.TagPrefix}-{contexts.Event.Input.Version}");
141157

142158
foreach (var project in component.Projects)

.github/workflows/access-token-management-release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ on:
99
type: string
1010
required: true
1111
default: '0.0.0'
12-
target-branch:
12+
branch:
1313
description: '(Optional) the name of the branch to release from'
1414
type: string
1515
required: false
1616
default: 'main'
17+
remove-tag-if-exists:
18+
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
19+
type: boolean
20+
required: false
21+
default: false
1722
env:
1823
DOTNET_NOLOGO: true
1924
DOTNET_CLI_TELEMETRY_OPTOUT: true
@@ -43,10 +48,21 @@ jobs:
4348
6.0.x
4449
8.0.x
4550
9.0.x
46-
- name: Git tag
51+
- name: Git Config
4752
run: |-
4853
git config --global user.email "github-bot@duendesoftware.com"
4954
git config --global user.name "Duende Software GitHub Bot"
55+
- name: Remove previous git tag
56+
if: github.event.inputs['remove-tag-if-exists'] == 'true'
57+
run: |-
58+
if git rev-parse atm-${{ github.event.inputs.version }} >/dev/null 2>&1; then
59+
git tag -d atm-${{ github.event.inputs.version }}
60+
git push --delete origin atm-${{ github.event.inputs.version }}
61+
else
62+
echo 'Tag atm-${{ github.event.inputs.version }} does not exist.'
63+
fi
64+
- name: Git tag
65+
run: |-
5066
git tag -a atm-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
5167
git push origin atm-${{ github.event.inputs.version }}
5268
- name: Pack AccessTokenManagement

.github/workflows/identity-model-oidc-client-release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ on:
99
type: string
1010
required: true
1111
default: '0.0.0'
12-
target-branch:
12+
branch:
1313
description: '(Optional) the name of the branch to release from'
1414
type: string
1515
required: false
1616
default: 'main'
17+
remove-tag-if-exists:
18+
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
19+
type: boolean
20+
required: false
21+
default: false
1722
env:
1823
DOTNET_NOLOGO: true
1924
DOTNET_CLI_TELEMETRY_OPTOUT: true
@@ -43,10 +48,21 @@ jobs:
4348
6.0.x
4449
8.0.x
4550
9.0.x
46-
- name: Git tag
51+
- name: Git Config
4752
run: |-
4853
git config --global user.email "github-bot@duendesoftware.com"
4954
git config --global user.name "Duende Software GitHub Bot"
55+
- name: Remove previous git tag
56+
if: github.event.inputs['remove-tag-if-exists'] == 'true'
57+
run: |-
58+
if git rev-parse imoc-${{ github.event.inputs.version }} >/dev/null 2>&1; then
59+
git tag -d imoc-${{ github.event.inputs.version }}
60+
git push --delete origin imoc-${{ github.event.inputs.version }}
61+
else
62+
echo 'Tag imoc-${{ github.event.inputs.version }} does not exist.'
63+
fi
64+
- name: Git tag
65+
run: |-
5066
git tag -a imoc-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
5167
git push origin imoc-${{ github.event.inputs.version }}
5268
- name: Pack IdentityModel.OidcClient

.github/workflows/identity-model-release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ on:
99
type: string
1010
required: true
1111
default: '0.0.0'
12-
target-branch:
12+
branch:
1313
description: '(Optional) the name of the branch to release from'
1414
type: string
1515
required: false
1616
default: 'main'
17+
remove-tag-if-exists:
18+
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
19+
type: boolean
20+
required: false
21+
default: false
1722
env:
1823
DOTNET_NOLOGO: true
1924
DOTNET_CLI_TELEMETRY_OPTOUT: true
@@ -43,10 +48,21 @@ jobs:
4348
6.0.x
4449
8.0.x
4550
9.0.x
46-
- name: Git tag
51+
- name: Git Config
4752
run: |-
4853
git config --global user.email "github-bot@duendesoftware.com"
4954
git config --global user.name "Duende Software GitHub Bot"
55+
- name: Remove previous git tag
56+
if: github.event.inputs['remove-tag-if-exists'] == 'true'
57+
run: |-
58+
if git rev-parse im-${{ github.event.inputs.version }} >/dev/null 2>&1; then
59+
git tag -d im-${{ github.event.inputs.version }}
60+
git push --delete origin im-${{ github.event.inputs.version }}
61+
else
62+
echo 'Tag im-${{ github.event.inputs.version }} does not exist.'
63+
fi
64+
- name: Git tag
65+
run: |-
5066
git tag -a im-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
5167
git push origin im-${{ github.event.inputs.version }}
5268
- name: Pack IdentityModel

.github/workflows/ignore-this-release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,11 +9,16 @@ on:
99
type: string
1010
required: true
1111
default: '0.0.0'
12-
target-branch:
12+
branch:
1313
description: '(Optional) the name of the branch to release from'
1414
type: string
1515
required: false
1616
default: 'main'
17+
remove-tag-if-exists:
18+
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
19+
type: boolean
20+
required: false
21+
default: false
1722
env:
1823
DOTNET_NOLOGO: true
1924
DOTNET_CLI_TELEMETRY_OPTOUT: true
@@ -43,10 +48,21 @@ jobs:
4348
6.0.x
4449
8.0.x
4550
9.0.x
46-
- name: Git tag
51+
- name: Git Config
4752
run: |-
4853
git config --global user.email "github-bot@duendesoftware.com"
4954
git config --global user.name "Duende Software GitHub Bot"
55+
- name: Remove previous git tag
56+
if: github.event.inputs['remove-tag-if-exists'] == 'true'
57+
run: |-
58+
if git rev-parse it-${{ github.event.inputs.version }} >/dev/null 2>&1; then
59+
git tag -d it-${{ github.event.inputs.version }}
60+
git push --delete origin it-${{ github.event.inputs.version }}
61+
else
62+
echo 'Tag it-${{ github.event.inputs.version }} does not exist.'
63+
fi
64+
- name: Git tag
65+
run: |-
5066
git tag -a it-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
5167
git push origin it-${{ github.event.inputs.version }}
5268
- name: Pack IgnoreThis

0 commit comments

Comments
 (0)