Skip to content

Commit

Permalink
add tag override
Browse files Browse the repository at this point in the history
  • Loading branch information
Erwinvandervalk committed Feb 18, 2025
1 parent 3a6c226 commit 245b2e2
Show file tree
Hide file tree
Showing 5 changed files with 93 additions and 13 deletions.
26 changes: 21 additions & 5 deletions .github/workflow-gen/Program.cs
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,9 @@ void GenerateReleaseWorkflow(Component component)
workflow.On
.WorkflowDispatch()
.Inputs(
new StringInput("version", "Version in format X.Y.Z or X.Y.Z-preview.", true, "0.0.0")
, new StringInput("target-branch", "(Optional) the name of the branch to release from", false, "main"));
new StringInput("version", "Version in format X.Y.Z or X.Y.Z-preview.", true, "0.0.0"),
new StringInput("branch", "(Optional) the name of the branch to release from", false, "main"),
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));

workflow.EnvDefaults();

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

tagJob.StepSetupDotNet();


tagJob.Step()
.Name("Git Config")
.Run(@"git config --global user.email ""[email protected]""
git config --global user.name ""Duende Software GitHub Bot""");

tagJob.Step()
.Name("Remove previous git tag")
.If("github.event.inputs['remove-tag']")
.Run($@"if git rev-parse {component.TagPrefix}-{contexts.Event.Input.Version} >/dev/null 2>&1; then
git tag -d {component.TagPrefix}-{contexts.Event.Input.Version}
git push --delete origin {component.TagPrefix}-{contexts.Event.Input.Version}
else
echo 'Tag {component.TagPrefix}-{contexts.Event.Input.Version} does not exist.'
fi");


tagJob.Step()
.Name("Git tag")
.Run($@"git config --global user.email ""[email protected]""
git config --global user.name ""Duende Software GitHub Bot""
git tag -a {component.TagPrefix}-{contexts.Event.Input.Version} -m ""Release v{contexts.Event.Input.Version}""
.Run($@"git tag -a {component.TagPrefix}-{contexts.Event.Input.Version} -m ""Release v{contexts.Event.Input.Version}""
git push origin {component.TagPrefix}-{contexts.Event.Input.Version}");

foreach (var project in component.Projects)
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/access-token-management-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ on:
type: string
required: true
default: '0.0.0'
target-branch:
branch:
description: '(Optional) the name of the branch to release from'
type: string
required: false
default: 'main'
remove-tag-if-exists:
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
type: boolean
required: false
default: false
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand Down Expand Up @@ -43,10 +48,21 @@ jobs:
6.0.x
8.0.x
9.0.x
- name: Git tag
- name: Git Config
run: |-
git config --global user.email "[email protected]"
git config --global user.name "Duende Software GitHub Bot"
- name: Remove previous git tag
if: github.event.inputs['remove-tag']
run: |-
if git rev-parse atm-${{ github.event.inputs.version }} >/dev/null 2>&1; then
git tag -d atm-${{ github.event.inputs.version }}
git push --delete origin atm-${{ github.event.inputs.version }}
else
echo 'Tag atm-${{ github.event.inputs.version }} does not exist.'
fi
- name: Git tag
run: |-
git tag -a atm-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
git push origin atm-${{ github.event.inputs.version }}
- name: Pack AccessTokenManagement
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/identity-model-oidc-client-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ on:
type: string
required: true
default: '0.0.0'
target-branch:
branch:
description: '(Optional) the name of the branch to release from'
type: string
required: false
default: 'main'
remove-tag-if-exists:
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
type: boolean
required: false
default: false
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand Down Expand Up @@ -43,10 +48,21 @@ jobs:
6.0.x
8.0.x
9.0.x
- name: Git tag
- name: Git Config
run: |-
git config --global user.email "[email protected]"
git config --global user.name "Duende Software GitHub Bot"
- name: Remove previous git tag
if: github.event.inputs['remove-tag']
run: |-
if git rev-parse imoc-${{ github.event.inputs.version }} >/dev/null 2>&1; then
git tag -d imoc-${{ github.event.inputs.version }}
git push --delete origin imoc-${{ github.event.inputs.version }}
else
echo 'Tag imoc-${{ github.event.inputs.version }} does not exist.'
fi
- name: Git tag
run: |-
git tag -a imoc-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
git push origin imoc-${{ github.event.inputs.version }}
- name: Pack IdentityModel.OidcClient
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/identity-model-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ on:
type: string
required: true
default: '0.0.0'
target-branch:
branch:
description: '(Optional) the name of the branch to release from'
type: string
required: false
default: 'main'
remove-tag-if-exists:
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
type: boolean
required: false
default: false
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand Down Expand Up @@ -43,10 +48,21 @@ jobs:
6.0.x
8.0.x
9.0.x
- name: Git tag
- name: Git Config
run: |-
git config --global user.email "[email protected]"
git config --global user.name "Duende Software GitHub Bot"
- name: Remove previous git tag
if: github.event.inputs['remove-tag']
run: |-
if git rev-parse im-${{ github.event.inputs.version }} >/dev/null 2>&1; then
git tag -d im-${{ github.event.inputs.version }}
git push --delete origin im-${{ github.event.inputs.version }}
else
echo 'Tag im-${{ github.event.inputs.version }} does not exist.'
fi
- name: Git tag
run: |-
git tag -a im-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
git push origin im-${{ github.event.inputs.version }}
- name: Pack IdentityModel
Expand Down
20 changes: 18 additions & 2 deletions .github/workflows/ignore-this-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,16 @@ on:
type: string
required: true
default: '0.0.0'
target-branch:
branch:
description: '(Optional) the name of the branch to release from'
type: string
required: false
default: 'main'
remove-tag-if-exists:
description: 'If set, will remove the existing tag. Use this if you have issues with the previous release action'
type: boolean
required: false
default: false
env:
DOTNET_NOLOGO: true
DOTNET_CLI_TELEMETRY_OPTOUT: true
Expand Down Expand Up @@ -43,10 +48,21 @@ jobs:
6.0.x
8.0.x
9.0.x
- name: Git tag
- name: Git Config
run: |-
git config --global user.email "[email protected]"
git config --global user.name "Duende Software GitHub Bot"
- name: Remove previous git tag
if: github.event.inputs['remove-tag']
run: |-
if git rev-parse it-${{ github.event.inputs.version }} >/dev/null 2>&1; then
git tag -d it-${{ github.event.inputs.version }}
git push --delete origin it-${{ github.event.inputs.version }}
else
echo 'Tag it-${{ github.event.inputs.version }} does not exist.'
fi
- name: Git tag
run: |-
git tag -a it-${{ github.event.inputs.version }} -m "Release v${{ github.event.inputs.version }}"
git push origin it-${{ github.event.inputs.version }}
- name: Pack IgnoreThis
Expand Down

0 comments on commit 245b2e2

Please sign in to comment.