Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
88 changes: 56 additions & 32 deletions docs/docs/inputs.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@ pageClass: inputs-page

| Input Name | Default Input Value | Short Description of Input |
| :------------------------------- | :---------------------------- | :---------------------------------------- |
| [name](#name) **\*** <CB /> | - | Stack Name |
| [url](#url) **\*** <CB /> | - | Portainer URL |
| [token](#token) **\*** <CB /> | - | Portainer Token |
| [name](#name) **\*** <CB /> | _Required_ | Stack Name |
| [url](#url) **\*** <CB /> | _Required_ | Portainer URL |
| [token](#token) **\*** <CB /> | _Required_ | Portainer Token |
| [file](#file) <CB /> | `docker-compose.yaml` | Compose File |
| [endpoint](#endpoint) <CB /> | `endpoints[0].Id` | Portainer Endpoint |
| [ref](#ref) <CB /> | `current reference` | Repository Ref |
Expand All @@ -21,13 +21,14 @@ pageClass: inputs-page
| [pull](#pull) <CB /> | `true` | Pull Images |
| [type](#type) <CB /> | `repo` | Type [`repo`, `file`] |
| [standalone](#standalone) <CB /> | `false` | Deploy Standalone Stack |
| [env_json](#env_json) <CB /> | - | Dotenv JSON Data |
| [env_data](#env_data) <CB /> | - | Dotenv JSON Data |
| [env_json](#env_data) <CB /> | **DEPRECATED** | Use [env_data](#env_data) |
| [env_file](#env_file) <CB /> | - | Dotenv File Path |
| [merge_env](#merge_env) <CB /> | `false` | Merge Env Vars |
| [username](#username) <CB /> | - | Repository Username |
| [password](#password) <CB /> | - | Repository Password |
| [headers](#headers) <CB /> | `"{}"` | Custom Headers JSON |
| [fs_path](#fs_path) **¹** <CB /> | - | Relative Path (BE) |
| [headers](#headers) <CB /> | `"{}"` | Custom Headers JSON |
| [summary](#summary) <CB /> | `true` | Add Summary to Job |

> **\* Required**
Expand Down Expand Up @@ -78,7 +79,7 @@ Default: `${endpoints[0]}`

This defaults to the reference that triggered the workflow.

If deploying from a different repository than the current one, you may want to specify the `ref` of that repository to deploy from.
If deploying from a different [repo](#repo) than the current one, you may want to specify the `ref` of that repository to deploy from.

Example: `refs/heads/master`

Expand All @@ -90,6 +91,8 @@ This defaults to the repository running the action.

If you want to deploy a different repository, put the full http URL to that repository.

Note: you probably also want to specify the [ref](#ref) from that repository to use.

Example: `https://github.com/cssnr/portainer-stack-deploy-action`

Default: <span v-pre>`${{ github.server_url }}/${{ github.repository }}`</span>
Expand Down Expand Up @@ -122,28 +125,35 @@ Default: `repo`

### standalone <CB />

Deploy a **compose** stack instead of _swarm_.
Set to `true` to enable.
Deploy a **compose** stack instead of _swarm_. Set to `true` to enable.

Default: `false`

### env_json <CB /> {#env_json}
### env_data <CB /> {#env_data}

Optional environment variables used when creating the stack.
File should be in dotenv format and JSON should be an object. Example: {"KEY": "Value"}

This can be used with [env_file](#env_file). Values in [env_file](#env_file) take precedence over these values.
These can be provided in JSON or YAML format and can be used with [env_file](#env_file).
Values in [env_file](#env_file) take precedence over these values.

::: details View JSON Input Examples
::: details View JSON/YAML Input Examples

These examples are identical, just different ways of passing the input.

::: code-group

```yaml [YAML]
- uses: cssnr/portainer-stack-deploy-action@v1
with:
env_data: |
KEY: Value
KEY_2: Value 2
```

```yaml [Multi-Line JSON]
- uses: cssnr/portainer-stack-deploy-action@v1
with:
env_json: |
env_data: |
{
"KEY": "Value",
"KEY_2": "Value 2"
Expand All @@ -153,7 +163,7 @@ These examples are identical, just different ways of passing the input.
```yaml [Single Line JSON]
- uses: cssnr/portainer-stack-deploy-action@v1
with:
env_json: '{"KEY": "Value", "KEY_2": "Value 2"}'
env_data: '{"KEY": "Value", "KEY_2": "Value 2"}'
```

Note: Additional [inputs](../docs/inputs.md) are excluded for brevity.
Expand All @@ -162,16 +172,16 @@ Note: Additional [inputs](../docs/inputs.md) are excluded for brevity.

::: warning
Inputs are NOT secure unless using secrets or secure output (masked).
Using `env_json` on a public repository will otherwise expose this data in the actions' logs.
For an example of an action that produces secure out for use with `env_json` see the [hashicorp/vault-action example](../guides/examples.md#multi-step).
Using `env_data` on a public repository will otherwise expose this data in the actions' logs.
For an example of an action that produces secure out for use with `env_data` see the [hashicorp/vault-action example](../guides/examples.md#multi-step).
To securely pass unmasked values, use the [env_file](#env_file) option.
:::

### env_file <CB /> {#env_file}

Environment File in [dotenv](https://www.npmjs.com/package/dotenv) format, parsed using [dotenv](https://www.npmjs.com/package/dotenv).

This can be used with [env_json](#env_json). Values in this file take precedence over [env_json](#env_json).
This can be used with [env_data](#env_data). Values in this file take precedence over [env_data](#env_data).

::: details View Environment File Input Example

Expand All @@ -194,9 +204,9 @@ Note: Additional [inputs](../docs/inputs.md) are excluded for brevity.
### merge_env <CB /> {#merge_env}

Set this to `true` to merge the current environment variables from the existing stack
with any newly provided variables in the [env_json](#env_json) or [env_file](#env_file) inputs.
with any newly provided variables in the [env_data](#env_data) or [env_file](#env_file) inputs.

When not providing the [env_json](#env_json) or [env_file](#env_file) inputs the
When not providing the [env_data](#env_data) or [env_file](#env_file) inputs the
current environment variables from the existing stack are always used.

When deploying a new stack, there are no current environment variables to merge, and this has no effect.
Expand All @@ -215,41 +225,55 @@ Password for private repository authentication when [type](#type) is set to `rep

This is **NOT** your Portainer password, see [token](#token) for Portainer authentication.

### fs_path <CB /> <Badge type="tip" text="Business Edition" /> {#fs_path}

Relative Path Support for Portainer BE.
Set this to enable relative path volumes support for volume mappings in your compose file.

_For more info see the [Portainer Documentation - Relative Path Support](https://docs.portainer.io/advanced/relative-paths)._

### headers <CB />

Custom Headers in **JSON** format for services like Cloudflare Zero Trust.
Custom Headers in JSON or YAML format for services like Cloudflare Zero Trust.

The `headers` are parsed with JSON.parse and passed directly to axios:
The `headers` are parsed with `JSON.parse` or `yaml.load` and passed directly to axios.

```javascript
headers: { 'X-API-Key': token, ...JSON.parse(headers) }
```

::: details View Headers Input Example

```yaml
::: code-group

```yaml [YAML]
- uses: cssnr/portainer-stack-deploy-action@v1
with:
headers: |
env_data: |
CF-Access-Client-Id: ${{ secrets.CF_CLIENT_ID }}
CF-Access-Client-Secret: ${{ secrets.CF_CLIENT_SECRET }}
```

```yaml [Multi-Line JSON]
- uses: cssnr/portainer-stack-deploy-action@v1
with:
env_data: |
{
"CF-Access-Client-Id": "${{ secrets.CF_CLIENT_ID }}",
"CF-Access-Client-Secret": "${{ secrets.CF_CLIENT_SECRET }}"
}
```

```yaml [toJSON Output]
- uses: cssnr/portainer-stack-deploy-action@v1
with:
env_data: ${{ toJSON(steps.import-secrets.outputs) }}
```

Note: Additional [inputs](../docs/inputs.md) are excluded for brevity.

:::

Default: `"{}"`

### fs_path <CB /> <Badge type="tip" text="Business Edition" /> {#fs_path}

Relative Path Support for Portainer BE.
Set this to enable relative path volumes support for volume mappings in your compose file.

_For more info see the [Portainer Documentation - Relative Path Support](https://docs.portainer.io/advanced/relative-paths)._

### summary <CB />

Write a Summary for the job. To disable this set to `false`.
Expand Down
2 changes: 1 addition & 1 deletion docs/guides/features.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ and [Business Enterprise Edition](https://www.portainer.io/solutions/portainer-f
- Deploy or re-deploy an existing stack otherwise create a new stack.
- Deploy from a repository or a compose file, see [type](../docs/inputs.md#type).
- Deploy from a different [repo](../docs/inputs.md#repo) than the current one.
- Provide environment variables in [JSON](../docs/inputs.md#env_json) or [file](../docs/inputs.md#env_file) format.
- Provide environment variables in [JSON/YAML](../docs/inputs.md#env_data) or [file](../docs/inputs.md#env_file) format.
- Automatically parse [Endpoint ID](../docs/inputs.md#endpoint) if only one endpoint.
- Supports Docker Swarm and Docker [Standalone](../docs/inputs.md#standalone).
- Supports custom [headers](../docs/inputs#headers) for services like Cloudflare Zero Trust.
Expand Down
4 changes: 2 additions & 2 deletions docs/guides/get-started.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,8 @@ You only need to set the [name](../docs/inputs.md#name), [url](../docs/inputs.md
The compose [file](../docs/inputs.md#file) path is relative to your working directory.
If you check out your repository to the root and your compose file is in the `app` directory, set [file](../docs/inputs.md#file) to: `app/docker-compose.yaml`

You can provide environment variables from either a file or JSON.
If providing secrets via [env_json](../docs/inputs.md#env_json) they should come from secure input (masked).
You can provide environment variables from either a file or JSON/YAML.
If providing secrets via [env_data](../docs/inputs.md#env_data) they should come from secure input (masked).

<div class="tip custom-block" style="padding-top: 8px">

Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/examples/multi/tojson.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -17,4 +17,4 @@
file: "docker-compose.yaml"
url: ${{ secrets.PORTAINER_URL }}
token: ${{ secrets.PORTAINER_TOKEN }}
env_json: ${{ toJSON(steps.import-secrets.outputs) }}
env_data: ${{ toJSON(steps.import-secrets.outputs) }}
2 changes: 1 addition & 1 deletion docs/snippets/examples/steps/env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
file: "docker-compose.yaml"
url: ${{ secrets.PORTAINER_URL }}
token: ${{ secrets.PORTAINER_TOKEN }}
env_json: '{"KEY": "Value"}'
env_data: '{"KEY": "Value"}'
env_file: .env
2 changes: 1 addition & 1 deletion docs/snippets/examples/steps/json.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
file: "docker-compose.yaml"
url: ${{ secrets.PORTAINER_URL }}
token: ${{ secrets.PORTAINER_TOKEN }}
env_json: |
env_data: |
{
"APP_PRIVATE_KEY": "${{ secrets.APP_PRIVATE_KEY }}",
"VERSION": "${{ inputs.VERSION }}"
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/examples/steps/merge-env.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -5,5 +5,5 @@
file: "docker-compose.yaml"
url: ${{ secrets.PORTAINER_URL }}
token: ${{ secrets.PORTAINER_TOKEN }}
env_json: '{"KEY": "Value"}'
env_data: '{"KEY": "Value"}'
merge_env: true
2 changes: 1 addition & 1 deletion docs/snippets/examples/workflows/full.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ jobs:
name: ${{ env.stack-name }}
username: ${{ vars.GHCR_USER }}
password: ${{ secrets.GHCR_PASS }}
env_json: |
env_data: |
{
"VERSION": "$${{ github.ref_name }}",
"STACK_NAME": "${{ env.stack-name }}",
Expand Down
2 changes: 1 addition & 1 deletion docs/snippets/examples/workflows/workflow-run.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ jobs:
name: ${{ env.stack-name }}
username: ${{ vars.GHCR_USER }}
password: ${{ secrets.GHCR_PASS }}
env_json: |
env_data: |
{
"VERSION": "${{ env.version == 'master' && 'latest' || env.version }}",
"STACK_NAME": "${{ env.stack-name }}",
Expand Down