From 9fbacc5cc4121f63c7c82f953ddaeda24b030fd3 Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Fri, 21 Nov 2025 08:34:24 +0100 Subject: [PATCH 1/2] feat: support for bootstrapping actions with yarn or pnpm Signed-off-by: David Dal Busco --- .prettierignore | 2 +- boilerplate/github/{ => npm}/deploy.yml | 2 +- boilerplate/github/{ => npm}/publish.yml | 6 ++-- boilerplate/github/pnpm/deploy.yml | 32 +++++++++++++++++++ boilerplate/github/pnpm/publish.yml | 37 ++++++++++++++++++++++ boilerplate/github/yarn/deploy.yml | 34 +++++++++++++++++++++ boilerplate/github/yarn/publish.yml | 39 ++++++++++++++++++++++++ 7 files changed, 147 insertions(+), 5 deletions(-) rename boilerplate/github/{ => npm}/deploy.yml (94%) rename boilerplate/github/{ => npm}/publish.yml (81%) create mode 100644 boilerplate/github/pnpm/deploy.yml create mode 100644 boilerplate/github/pnpm/publish.yml create mode 100644 boilerplate/github/yarn/deploy.yml create mode 100644 boilerplate/github/yarn/publish.yml diff --git a/.prettierignore b/.prettierignore index f73b850b..7e5a9e41 100644 --- a/.prettierignore +++ b/.prettierignore @@ -1,3 +1,3 @@ dist templates -boilerplate \ No newline at end of file +boilerplate/functions \ No newline at end of file diff --git a/boilerplate/github/deploy.yml b/boilerplate/github/npm/deploy.yml similarity index 94% rename from boilerplate/github/deploy.yml rename to boilerplate/github/npm/deploy.yml index fe7013c8..09f5c1aa 100644 --- a/boilerplate/github/deploy.yml +++ b/boilerplate/github/npm/deploy.yml @@ -23,6 +23,6 @@ jobs: - name: Deploy to Juno uses: junobuild/juno-action@main with: - args: deploy + args: hosting deploy env: JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }} diff --git a/boilerplate/github/publish.yml b/boilerplate/github/npm/publish.yml similarity index 81% rename from boilerplate/github/publish.yml rename to boilerplate/github/npm/publish.yml index 250f2de0..99e9f53a 100644 --- a/boilerplate/github/publish.yml +++ b/boilerplate/github/npm/publish.yml @@ -3,7 +3,7 @@ name: Publish Serverless Functions on: workflow_dispatch: release: - types: [ released ] + types: [released] jobs: publish: @@ -15,7 +15,7 @@ jobs: - uses: actions/setup-node@v4 with: node-version: 24 - registry-url: "https://registry.npmjs.org" + registry-url: 'https://registry.npmjs.org' - name: Install Dependencies run: npm ci @@ -30,4 +30,4 @@ jobs: with: args: functions publish env: - JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }} \ No newline at end of file + JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }} diff --git a/boilerplate/github/pnpm/deploy.yml b/boilerplate/github/pnpm/deploy.yml new file mode 100644 index 00000000..aa0e174c --- /dev/null +++ b/boilerplate/github/pnpm/deploy.yml @@ -0,0 +1,32 @@ +name: Deploy to Juno + +on: + workflow_dispatch: + push: + branches: [main] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: 'https://registry.npmjs.org' + + - uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Install Dependencies + run: pnpm i --frozen-lockfile + + - name: Deploy to Juno + uses: junobuild/juno-action@main + with: + args: hosting deploy + env: + JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }} diff --git a/boilerplate/github/pnpm/publish.yml b/boilerplate/github/pnpm/publish.yml new file mode 100644 index 00000000..6f78ba9b --- /dev/null +++ b/boilerplate/github/pnpm/publish.yml @@ -0,0 +1,37 @@ +name: Publish Serverless Functions + +on: + workflow_dispatch: + release: + types: [released] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: 'https://registry.npmjs.org' + + - uses: pnpm/action-setup@v4 + with: + version: 10 + + - name: Install Dependencies + run: pnpm i --frozen-lockfile + + - name: Build + uses: junobuild/juno-action@full + with: + args: functions build + + - name: Publish + uses: junobuild/juno-action@full + with: + args: functions publish + env: + JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }} diff --git a/boilerplate/github/yarn/deploy.yml b/boilerplate/github/yarn/deploy.yml new file mode 100644 index 00000000..39363f32 --- /dev/null +++ b/boilerplate/github/yarn/deploy.yml @@ -0,0 +1,34 @@ +name: Deploy to Juno + +on: + workflow_dispatch: + push: + branches: [main] + +jobs: + deploy: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: 'https://registry.npmjs.org' + + - name: Enable Corepack + run: corepack enable + + - name: Activate Yarn + run: corepack prepare yarn@1.x --activate + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Deploy to Juno + uses: junobuild/juno-action@main + with: + args: hosting deploy + env: + JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }} diff --git a/boilerplate/github/yarn/publish.yml b/boilerplate/github/yarn/publish.yml new file mode 100644 index 00000000..a24bfb79 --- /dev/null +++ b/boilerplate/github/yarn/publish.yml @@ -0,0 +1,39 @@ +name: Publish Serverless Functions + +on: + workflow_dispatch: + release: + types: [released] + +jobs: + publish: + runs-on: ubuntu-latest + steps: + - name: Check out the repo + uses: actions/checkout@v4 + + - uses: actions/setup-node@v4 + with: + node-version: 24 + registry-url: 'https://registry.npmjs.org' + + - name: Enable Corepack + run: corepack enable + + - name: Activate Yarn + run: corepack prepare yarn@1.x --activate + + - name: Install Dependencies + run: yarn install --frozen-lockfile + + - name: Build + uses: junobuild/juno-action@full + with: + args: functions build + + - name: Publish + uses: junobuild/juno-action@full + with: + args: functions publish + env: + JUNO_TOKEN: ${{ secrets.JUNO_TOKEN }} From 018af0de948d1034d4de490b1f20c33e691cc45c Mon Sep 17 00:00:00 2001 From: David Dal Busco Date: Fri, 21 Nov 2025 09:01:16 +0100 Subject: [PATCH 2/2] feat: boiletplate source with pm Signed-off-by: David Dal Busco --- src/services/generate.services.ts | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/services/generate.services.ts b/src/services/generate.services.ts index b3a8110a..830ff27c 100644 --- a/src/services/generate.services.ts +++ b/src/services/generate.services.ts @@ -16,6 +16,7 @@ import { getLocalTemplatePath, getRelativeTemplatePath } from '../utils/fs.utils'; +import {whichPMRuns} from '../utils/pm.utils'; import {createDirectory, getLocalFiles, type LocalFileDescriptor} from '../utils/populate.utils'; export const generate = async ({gitHubAction, serverlessFunctions, ...rest}: PopulateInput) => { @@ -133,15 +134,14 @@ const populateGitHubAction = async ({ createFolders(target); - if (isNullish(serverlessFunctions)) { - const source = join(BOILERPLATE_PATH, 'github'); + const pm = whichPMRuns(); + const source = join(BOILERPLATE_PATH, 'github', pm); + if (isNullish(serverlessFunctions)) { await copyFile({source, target, file: 'deploy.yml'}); return; } - const source = join(BOILERPLATE_PATH, 'github'); - await copyFiles({source, target}); };