Skip to content

Commit 4c4ee12

Browse files
feat(input): add optional build-cmd option (#76)
Co-authored-by: Chris Swithinbank <[email protected]>
1 parent e8cea0c commit 4c4ee12

File tree

2 files changed

+8
-2
lines changed

2 files changed

+8
-2
lines changed

README.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@ For more information, please see our complete deployment guide—[Deploy your As
1313
- `path` - Optional: the root location of your Astro project inside the repository.
1414
- `node-version` - Optional: the specific version of Node that should be used to build your site. Defaults to `22`.
1515
- `package-manager` - Optional: the Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. Accepted values: `npm`, `yarn`, `pnpm`, and `bun`. A version tag is also accepted, for example `[email protected]`, `pnpm@8`, or `bun@latest`. If not provided, version will default to `latest`.
16+
- `build-cmd` - Optional: the command to run to build your site. Defaults to `deno task build` for sites using Deno and to `<package-manager> run build` for all other package managers.
1617

1718
### Example workflow:
1819

@@ -49,6 +50,7 @@ jobs:
4950
# path: . # The root location of your Astro project inside the repository. (optional)
5051
# node-version: 22 # The specific version of Node that should be used to build your site. Defaults to 22. (optional)
5152
# package-manager: pnpm@latest # The Node package manager that should be used to install dependencies and build your site. Automatically detected based on your lockfile. (optional)
53+
# build-cmd: pnpm run build # The command to run to build your site. Runs the package build script/task by default. (optional)
5254

5355
deploy:
5456
needs: build

action.yml

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@ inputs:
1616
description: "Path of the directory containing your site"
1717
required: false
1818
default: "."
19+
build-cmd:
20+
description: "The command used to build your site"
21+
required: false
22+
default:
1923

2024
runs:
2125
using: composite
@@ -131,13 +135,13 @@ runs:
131135
if: ${{ env.PACKAGE_MANAGER != 'deno' }}
132136
shell: bash
133137
working-directory: ${{ inputs.path }}
134-
run: $PACKAGE_MANAGER run build
138+
run: ${{ inputs.build-cmd || '$PACKAGE_MANAGER run build' }}
135139

136140
- name: Build (Deno)
137141
if: ${{ env.PACKAGE_MANAGER == 'deno' }}
138142
shell: bash
139143
working-directory: ${{ inputs.path }}
140-
run: deno task build
144+
run: ${{ inputs.build-cmd || 'deno task build' }}
141145

142146
- name: Upload Pages Artifact
143147
uses: actions/upload-pages-artifact@v3

0 commit comments

Comments
 (0)