Skip to content

Commit a0f4db1

Browse files
authored
Merge pull request #3794 from arturcic/feature/3727
#3727 - Update GitHub workflows and add Winget release
2 parents da08b7b + 247c949 commit a0f4db1

File tree

6 files changed

+95
-18
lines changed

6 files changed

+95
-18
lines changed

.github/workflows/ci.yml

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ on:
2121
- '!docs/**'
2222

2323
repository_dispatch:
24-
types: [ release ]
24+
types: [ ci-release ]
2525

2626
env:
2727
DOTNET_ROLL_FORWARD: "Major"
@@ -133,3 +133,12 @@ jobs:
133133
name: '[Release]'
134134
shell: pwsh
135135
run: dotnet run/release.dll --target=PublishRelease
136+
-
137+
name: '[Publish Release]'
138+
if: ${{ github.event_name == 'repository_dispatch' }}
139+
uses: peter-evans/repository-dispatch@v2
140+
with:
141+
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
142+
repository: ${{ github.repository }}
143+
event-type: publish-release
144+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "tag": "${{ github.event.client_payload.tag }}"}'

.github/workflows/docs.yml

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Verify & Publish Docs
33
on:
44
workflow_dispatch:
55
repository_dispatch:
6-
types: [release]
6+
types: [ publish-release ]
77
push:
88
branches:
99
- main
@@ -90,7 +90,7 @@ jobs:
9090

9191
validate:
9292
name: Validates Html
93-
needs: [prepare]
93+
needs: [ prepare ]
9494
runs-on: ubuntu-latest
9595
steps:
9696
-
@@ -126,7 +126,7 @@ jobs:
126126

127127
publish:
128128
name: Publish docs
129-
needs: [validate]
129+
needs: [ validate ]
130130
runs-on: windows-latest
131131
env:
132132
GITHUB_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}
@@ -147,7 +147,7 @@ jobs:
147147
dotnet run/docs.dll --target=GenerateSchemas
148148
-
149149
name: '[Publish Documentation]'
150-
if: ${{ github.event_name == 'push' }}
150+
if: ${{ github.event_name == 'repository_dispatch' }}
151151
shell: pwsh
152152
run: dotnet run/docs.dll --target=PublishDocs
153153
-

.github/workflows/homebrew.yml

Lines changed: 29 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
1-
name: Homebrew
1+
name: Publish to Homebrew
22

33
on:
44
workflow_dispatch:
5+
inputs:
6+
tag-name:
7+
description: 'The git tag name to bump the formula to'
8+
required: true
59
repository_dispatch:
6-
types: [release]
10+
types: [ publish-release ]
11+
712
permissions:
813
contents: read
914

@@ -14,10 +19,25 @@ jobs:
1419
name: Bump Homebrew formula
1520
runs-on: macos-latest
1621
steps:
17-
- uses: dawidd6/action-homebrew-bump-formula@v3
18-
with:
19-
# GitHub token, required, not the default one
20-
token: ${{secrets.RELEASE_GITHUB_TOKEN}}
21-
# Formula name, required
22-
formula: gitversion
23-
tag: ${{ github.event.client_payload.ref }}
22+
- name: Get version
23+
id: get-version
24+
shell: pwsh
25+
run: |
26+
$version = "${{ github.event.client_payload.tag }}"
27+
if ($version -eq "") {
28+
$version = "${{ github.event.inputs.tag-name }}"
29+
}
30+
"version=$version" >> $env:GITHUB_OUTPUT
31+
-
32+
uses: mislav/bump-homebrew-formula-action@v3
33+
name: Bump Homebrew formula
34+
with:
35+
formula-name: gitversion
36+
tag-name: ${{ steps.get-version.outputs.version }}
37+
download-url: https://github.com/GitTools/GitVersion/archive/refs/tags/${{ steps.get-version.outputs.version }}.tar.gz
38+
commit-message: |
39+
{{formulaName}} {{version}}
40+
41+
For additional details see https://github.com/GitTools/GitVersion/releases/tag/${{ steps.get-version.outputs.version }}
42+
env:
43+
COMMITTER_TOKEN: ${{ secrets.RELEASE_GITHUB_TOKEN }}

.github/workflows/release.yml

Lines changed: 11 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,24 @@
11
name: Release
22
on:
33
release:
4-
types: [published]
4+
types: [ published ]
55

66
jobs:
77
release:
8-
name: Trigger Build flow
8+
name: Trigger ci flow
99
runs-on: ubuntu-latest
1010
steps:
1111
- uses: actions/checkout@v4
12+
- name: Get version
13+
id: get-version
14+
shell: pwsh
15+
run: |
16+
# Finding the version from release tag
17+
$VERSION="${{ github.ref }}".Replace("refs/tags/", "")
18+
"version=$VERSION" >> $env:GITHUB_OUTPUT
1219
- uses: peter-evans/repository-dispatch@v2
1320
with:
1421
token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
1522
repository: ${{ github.repository }}
16-
event-type: release
17-
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}"}'
23+
event-type: ci-release
24+
client-payload: '{"ref": "${{ github.ref }}", "sha": "${{ github.sha }}", "tag": "${{ steps.get-version.outputs.version }}"}'

.github/workflows/winget.yml

Lines changed: 40 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,40 @@
1+
name: Publish to Winget
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
tag-name:
7+
description: 'The git tag name to bump the formula to'
8+
required: true
9+
repository_dispatch:
10+
types: [ publish-release ]
11+
12+
permissions:
13+
contents: read
14+
15+
jobs:
16+
homebrew:
17+
permissions:
18+
contents: none
19+
name: Bump winget manifest
20+
runs-on: ubuntu-latest
21+
steps:
22+
- name: Get version
23+
id: get-version
24+
shell: pwsh
25+
run: |
26+
$version = "${{ github.event.client_payload.tag }}"
27+
if ($version -eq "") {
28+
$version = "${{ github.event.inputs.tag-name }}"
29+
}
30+
31+
$url = "https://github.com/GitTools/GitVersion/releases/download/{0}/gitversion-win-{1}-{0}.zip"
32+
$urls = @(($url -f $version, "x64"), ($url -f $version, "arm64")) -Join ","
33+
34+
$run_args = "update --id GitTools.GitVersion --version $version --urls $urls --token ${{ secrets.RELEASE_GITHUB_TOKEN }} --submit"
35+
"version=$version" >> $env:GITHUB_OUTPUT
36+
"run_args=$run_args" >> $env:GITHUB_OUTPUT
37+
38+
- uses: michidk/run-komac@v1
39+
with:
40+
args: '${{ steps.get-version.outputs.run_args }}'

build/CI.sln

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -40,6 +40,7 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "workflows", "workflows", "{
4040
..\.github\workflows\_publish.yml = ..\.github\workflows\_publish.yml
4141
..\.github\workflows\_unit_tests.yml = ..\.github\workflows\_unit_tests.yml
4242
..\.github\workflows\stale.yml = ..\.github\workflows\stale.yml
43+
..\.github\workflows\winget.yml = ..\.github\workflows\winget.yml
4344
EndProjectSection
4445
EndProject
4546
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "actions", "actions", "{A9B92261-AB9C-47D6-A8A7-616A5A62B063}"

0 commit comments

Comments
 (0)