Skip to content

Commit 2e95417

Browse files
committed
Fixing Release process
part1
1 parent 23f5627 commit 2e95417

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ jobs:
4242
env:
4343
nuget-key: ${{ secrets.NUGET_KEY }}
4444
github-user: ${{ github.event.inputs.username }}
45-
github-pw: ${{ secrets.USER_TOKEN }}
45+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
4646
vsce-token: ${{ secrets.VSCE_TOKEN }}
4747
user-email: ${{ github.event.inputs.email }}
4848
run: dotnet run --project build -- -t Release

build/Program.fs

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,8 @@ let releaseNotesData = File.ReadAllLines "RELEASE_NOTES.md" |> ReleaseNotes.pars
2929

3030
let release = List.head releaseNotesData
3131

32+
let githubToken = Environment.environVarOrNone "GITHUB_TOKEN"
33+
3234
// --------------------------------------------------------------------------------------
3335
// Helper functions
3436
// --------------------------------------------------------------------------------------
@@ -227,11 +229,6 @@ let releaseGithub (release: ReleaseNotes.ReleaseNotes) =
227229
| s when not (String.IsNullOrWhiteSpace s) -> s
228230
| _ -> UserInput.getUserInput "Email: "
229231

230-
let pw =
231-
match Environment.environVarOrDefault "github-pw" "" with
232-
| s when not (String.IsNullOrWhiteSpace s) -> s
233-
| _ -> UserInput.getUserPassword "Password: "
234-
235232
let remote =
236233
CommandHelper.getGitResult "" "remote -v"
237234
|> Seq.filter (fun (s: string) -> s.EndsWith("(push)"))
@@ -249,9 +246,16 @@ let releaseGithub (release: ReleaseNotes.ReleaseNotes) =
249246

250247
let files = !!("./temp" </> "*.vsix")
251248

249+
let token =
250+
match githubToken with
251+
| Some s -> s
252+
| _ ->
253+
failwith
254+
"please set the github_token environment variable to a github personal access token with repo access."
255+
252256
// release on github
253257
let cl =
254-
GitHub.createClient user pw
258+
GitHub.createClientWithToken token
255259
|> GitHub.draftNewRelease
256260
gitOwner
257261
gitName
@@ -367,6 +371,8 @@ let initTargets () =
367371
Target.create "Release" ignore
368372

369373
let buildTargetTree () =
374+
Option.iter (TraceSecrets.register "<GITHUB_TOKEN>") githubToken
375+
370376
let (==>!) x y = x ==> y |> ignore
371377

372378
"YarnInstall" ==>! "RunScript"

0 commit comments

Comments
 (0)