-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add fetch_token with first build workflow
- Loading branch information
Showing
4 changed files
with
60 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
name: Compile fetch_token for Windows | ||
on: | ||
push: | ||
branches: [ main ] | ||
workflow_dispatch: | ||
|
||
jobs: | ||
build-windows: | ||
runs-on: windows-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
persist-credentials: false # otherwise, the token used is the GITHUB_TOKEN, instead of your personal token | ||
fetch-depth: 0 # otherwise, you will fail to push refs to dest repo | ||
- uses: actions/setup-node@v4 | ||
with: | ||
node-version: '20' | ||
- run: npm -g install bun | ||
- name: Compile fetch_token | ||
working-directory: fetch_token | ||
run: | | ||
bun install | ||
bun build ./fetch_token.js --compile --minify --outfile fetch_token.exe | ||
- name: Commit & Push changes | ||
uses: EndBug/add-and-commit@v9 | ||
with: | ||
add: 'fetch_token/fetch_token.exe' | ||
github_token: ${{ secrets.GITHUB_TOKEN }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,7 @@ | ||
#!/bin/sh | ||
if [ ! -d "bin" ]; then | ||
mkdir bin | ||
fi | ||
|
||
bun install | ||
bun build ./fetch_token.js --compile --minify --outfile fetch_token |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
import { DefaultAzureCredential } from "@azure/identity" | ||
|
||
const args = process.argv | ||
|
||
// remove program name from args | ||
args.shift(); | ||
args.shift(); | ||
|
||
// Azure SDK clients accept the credential as a parameter | ||
const credential = new DefaultAzureCredential() | ||
const token = await credential.getToken(args) | ||
|
||
console.log('TOKEN="' + token.token + '"') | ||
|
||
// needed for bun to really terminate, otherwise hangs here | ||
process.exit() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
{ | ||
"dependencies": { | ||
"@azure/identity": "^4.0.0" | ||
}, | ||
"type": "module", | ||
"devDependencies": { | ||
"@rollup/plugin-node-resolve": "^15.2.3" | ||
} | ||
} |