Skip to content

Commit e86bd2a

Browse files
committed
Add Github Actions automations (#4405)
* Add Github Actions automations - labeler: used for versions and marking commits as Infra - backport: we can now apply labels `backport $branch` and on PR close this will automatically open up the appropiate backport PR's If you call the release target e.g $ ./build.sh release 8.0.0-alpha2 This will now bump the version in both global.json as well as the autolabel.json * fix casing on label (cherry picked from commit f0ee705)
1 parent 163dc20 commit e86bd2a

File tree

6 files changed

+62
-1
lines changed

6 files changed

+62
-1
lines changed

.github/auto-label.json

+6
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
{
2+
"rules": {
3+
"Infra": [".ci/**/*", ".github/**/*","build/**/*"],
4+
"v8.0.0-alpha1": "**/*"
5+
}
6+
}

.github/workflows/auto-label.yml

+14
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
name: Auto Label
2+
on:
3+
pull_request:
4+
types: [opened, synchronize]
5+
6+
jobs:
7+
auto-label:
8+
name: Auto Label
9+
runs-on: ubuntu-latest
10+
steps:
11+
- uses: actions/checkout@v2
12+
- uses: banyan/[email protected]
13+
env:
14+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/backport.yml

+16
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
name: Backport
2+
on:
3+
pull_request:
4+
types:
5+
- closed
6+
- labeled
7+
8+
jobs:
9+
backport:
10+
runs-on: ubuntu-18.04
11+
name: Backport
12+
steps:
13+
- name: Backport
14+
uses: tibdex/backport@v1
15+
with:
16+
github_token: ${{ secrets.GITHUB_TOKEN }}

build/scripts/Versioning.fs

+14
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@ open System.IO
77

88
open Commandline
99
open Fake.Core
10+
open Fake.Core
1011
open Fake.IO
1112
open Fake.IO.Globbing.Operators
1213
open Newtonsoft.Json
@@ -26,6 +27,18 @@ module Versioning =
2627
let jsonString = File.ReadAllText "global.json"
2728
JsonConvert.DeserializeObject<GlobalJson>(jsonString)
2829

30+
let writeVersionIntoAutoLabel oldVersion newVersion =
31+
let path = Path.Join(".github","auto-label.json")
32+
let text = File.ReadAllText(path)
33+
let oldV = sprintf "v%s" oldVersion
34+
let newV = sprintf "v%s" newVersion
35+
if not(text.Contains(oldV)) then
36+
failwithf "auto-label.json does not contain %s" oldV
37+
38+
let replaced = String.replace oldV newV text
39+
File.WriteAllText(path, replaced)
40+
41+
2942
let writeVersionIntoGlobalJson version =
3043
let globalJson = globalJson ()
3144
let newGlobalJson = { globalJson with version = version.ToString(); }
@@ -77,6 +90,7 @@ module Versioning =
7790
if (currentVersion > newVersion) then
7891
failwithf "Can not release %O as it's lower than current %O" newVersion.Full currentVersion.Full
7992
writeVersionIntoGlobalJson newVersion.Full
93+
writeVersionIntoAutoLabel (currentVersion.Full.ToString()) (newVersion.Full.ToString())
8094
| _ -> ignore()
8195

8296
let ArtifactsVersion buildVersions =

build/scripts/scripts.fsproj

+11
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,17 @@
2626
<ItemGroup>
2727
<Content Include="..\..\build.sh"><Link>build.sh</Link></Content>
2828
<Content Include="..\..\build.bat"><Link>build.bat</Link></Content>
29+
<Content Include="..\..\appveyor.yml"><Link>appveyor.yml</Link></Content>
30+
<Content Include="..\..\azure-pipelines.yml"><Link>azure-pipelines.yml</Link></Content>
31+
<Content Include="..\..\.github\workflows\auto-label.yml">
32+
<Link>auto-label.yml</Link>
33+
</Content>
34+
<Content Include="..\..\.github\workflows\backport.yml">
35+
<Link>backport.yml</Link>
36+
</Content>
37+
<Content Include="..\..\.github\auto-label.json">
38+
<Link>auto-label.json</Link>
39+
</Content>
2940
</ItemGroup>
3041
<ItemGroup>
3142
<PackageReference Include="Bullseye" Version="3.0.0" />

global.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,4 +4,4 @@
44
},
55
"version": "6.8.3",
66
"doc_current": "6.8"
7-
}
7+
}

0 commit comments

Comments
 (0)