Skip to content

Commit

Permalink
Merge pull request #25 from hydephp/config-array
Browse files Browse the repository at this point in the history
Add a config input parameter to append to `hyde.yml` configuration
  • Loading branch information
caendesilva authored Jan 26, 2024
2 parents 2596dd9 + e6c06b1 commit c4e185d
Show file tree
Hide file tree
Showing 2 changed files with 31 additions and 0 deletions.
10 changes: 10 additions & 0 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,11 @@ inputs:
required: false
default: "."

config:
description: 'List of lines to add to the `hyde.yml` config file'
required: false
default: ""

env-site-name:
description: 'Set the `SITE_NAME` environment variable'
required: false
Expand Down Expand Up @@ -117,6 +122,11 @@ runs:
run: echo "TORCHLIGHT_TOKEN=${{ inputs.env-torchlight-token }}" >> .env
shell: bash

- name: Set up configuration
if: inputs.config != ''
run: echo "${{ inputs.config }}" >> hyde.yml
shell: bash

- name: Build the site
run: php hyde build --no-interaction --ansi
shell: bash
Expand Down
21 changes: 21 additions & 0 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -189,6 +189,27 @@ Specifies the directory containing the source files to build. This is useful if
* **Required**: `false`
* **Default**: `"."`

### `config`

You can also specify configuration options using the `config` input. The lines in this input will be appended to the `hyde.yml` file in the root directory, allowing you to configure many parts of the Hyde project before the build.

* **Description**: List of lines to add to the `hyde.yml` config file
* **Required**: `false`
* **Default**: `""`

Example:

```yaml
- uses: hydephp/action@config-array
with:
config: |
# Enter key-value Yaml here:
name: Example
url: ${{ github.deployment.url }}
```

See the [HydePHP documentation](https://hydephp.com/docs/1.x/customization#yaml-configuration) for more information on the available configuration options and how to use the `hyde.yml` file.

### Environment variables

>warning If your inputs contain sensitive information, you should use [GitHub Secrets](https://docs.github.com/en/actions/reference/encrypted-secrets) to store them.
Expand Down

0 comments on commit c4e185d

Please sign in to comment.