From fa2dd244d1326022dc5737f20ae64ddc8dee9ef9 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Tue, 7 May 2024 12:02:43 +0200 Subject: [PATCH 1/3] feat: Add basic CI workflow --- .github/workflows/_ci.yml | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100644 .github/workflows/_ci.yml diff --git a/.github/workflows/_ci.yml b/.github/workflows/_ci.yml new file mode 100644 index 0000000..48d1526 --- /dev/null +++ b/.github/workflows/_ci.yml @@ -0,0 +1,24 @@ +name: CI + +on: + pull_request_target: + branches: [main] + +jobs: + main: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version-file: .node-version + + - run: npm ci + - run: npm run format:check + - run: npm run lint + - run: npm run test + - run: npm run build + + - name: Check that dist/ is correctly generated + run: git diff --quiet HEAD main -- dist From 916427f457a54ba53e9db67557224ad8e6129081 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Tue, 7 May 2024 12:16:45 +0200 Subject: [PATCH 2/3] chore: Break publish-crates-homebrew action --- src/publish-crates-homebrew.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/publish-crates-homebrew.ts b/src/publish-crates-homebrew.ts index 4454d4a..e15d84e 100644 --- a/src/publish-crates-homebrew.ts +++ b/src/publish-crates-homebrew.ts @@ -27,7 +27,7 @@ export type Input = { }; export function setup(): Input { - const liveRun = core.getBooleanInput("live-run", { required: true }); + const liveRun = core.getBooleanInput("dry-run", { required: true }); const version = core.getInput("version", { required: true }); const repo = core.getInput("repo", { required: true }); const formulae = core.getInput("formulae", { required: true }); From ca78fabd124f31aadd6a310a528e06a89d998298 Mon Sep 17 00:00:00 2001 From: Mahmoud Mazouz Date: Tue, 7 May 2024 12:19:43 +0200 Subject: [PATCH 3/3] fix: Code formatting in src/ --- dist/publish-crates-homebrew-main.js | 2 +- src/publish-crates-debian.ts | 2 +- src/ssh.ts | 6 +----- 3 files changed, 3 insertions(+), 7 deletions(-) diff --git a/dist/publish-crates-homebrew-main.js b/dist/publish-crates-homebrew-main.js index 1350351..ac63794 100644 --- a/dist/publish-crates-homebrew-main.js +++ b/dist/publish-crates-homebrew-main.js @@ -127689,7 +127689,7 @@ _build_crates_standalone__WEBPACK_IMPORTED_MODULE_6__ = (__webpack_async_depende const artifact = new _actions_artifact__WEBPACK_IMPORTED_MODULE_3__.DefaultArtifactClient(); function setup() { - const liveRun = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getBooleanInput("live-run", { required: true }); + const liveRun = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getBooleanInput("dry-run", { required: true }); const version = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("version", { required: true }); const repo = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("repo", { required: true }); const formulae = _actions_core__WEBPACK_IMPORTED_MODULE_2__.getInput("formulae", { required: true }); diff --git a/src/publish-crates-debian.ts b/src/publish-crates-debian.ts index f677eab..1f51665 100644 --- a/src/publish-crates-debian.ts +++ b/src/publish-crates-debian.ts @@ -34,7 +34,7 @@ export function setup(): Input { const sshPrivateKey = core.getInput("ssh-private-key", { required: true }); const sshPassphrase = core.getInput("ssh-passphrase", { required: true }); const installationTest = core.getBooleanInput("installation-test", { required: true }); - const repo = core.getInput("repo", {required: true}); + const repo = core.getInput("repo", { required: true }); return { liveRun, diff --git a/src/ssh.ts b/src/ssh.ts index 0b994a5..76f558e 100644 --- a/src/ssh.ts +++ b/src/ssh.ts @@ -7,11 +7,7 @@ function setupAgent(): NodeJS.ProcessEnv { return Object.fromEntries([...commands.matchAll(/([A-Z_]+)=([^;]+);/g)].map(m => [m[1], m[2]])); } -export async function withIdentity( - privateKey: string, - passphrase: string, - fn: (env: NodeJS.ProcessEnv) => void, -) { +export async function withIdentity(privateKey: string, passphrase: string, fn: (env: NodeJS.ProcessEnv) => void) { const env = setupAgent(); const passphrasePath = "./.ssh_askpass"; await fs.writeFile(passphrasePath, `echo '${passphrase}'`, { mode: fs.constants.S_IRWXU });