Skip to content

Commit

Permalink
Merge branch 'v2'
Browse files Browse the repository at this point in the history
# Conflicts:
#	README.md
  • Loading branch information
cardinalby committed Jul 13, 2022
2 parents ad905dd + fb39b9a commit 8f935ca
Show file tree
Hide file tree
Showing 12 changed files with 2,652 additions and 2,817 deletions.
17 changes: 16 additions & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,21 @@ on:
workflow_dispatch:

jobs:
integration:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v2
with:
node-version: 16.x
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build
- name: Test
run: npm run test
doNotExpand:
runs-on: ubuntu-latest
steps:
Expand Down Expand Up @@ -106,4 +121,4 @@ jobs:

- name: Check JSON result
if: env.json != ''
run: exit 1
run: exit 1
4 changes: 2 additions & 2 deletions .github/workflows/test/case1.env
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# AAA=ggg
AAA=aaa#a
AAA="aaa#a"
BBB=val-${AAA}-lav
CCC=${JOBENV}
#AAA=ggg
#AAA=ggg
36 changes: 20 additions & 16 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,15 +9,15 @@ multiple workflows.

### Simple case:

```env
```dotenv
# constants.env file
VAR1=abc
VAR2=def
```

```yaml
- uses: cardinalby/export-env-action@v1
- uses: cardinalby/export-env-action@v2
with:
envFile: 'constants.env'

Expand All @@ -27,7 +27,7 @@ VAR2=def

### Expand variables

```env
```dotenv
# constants.env file
PROTOCOL=https
Expand All @@ -37,7 +37,7 @@ URI=${PROTOCOL}://${HOST}:${PORT}
```

```yaml
- uses: cardinalby/export-env-action@v1
- uses: cardinalby/export-env-action@v2
with:
envFile: 'constants.env'
expand: 'true'
Expand All @@ -50,15 +50,15 @@ URI=${PROTOCOL}://${HOST}:${PORT}

### Do not export:

```env
```dotenv
# constants.env file
VAR1=abc
VAR2=def
```

```yaml
- uses: cardinalby/export-env-action@v1
- uses: cardinalby/export-env-action@v2
id: exportStep
with:
envFile: 'constants.env'
Expand All @@ -72,21 +72,25 @@ VAR2=def

## Inputs

### 🔸 `envFile` **Required**
Path to env file to parse
### 🔸 `envFile` Required
Path to env file to parse.

### 🔸 `expand` Default: `false`
"Expands" variables if equals `true`. It means, `${ANOTHER}` in variable value will be
substituted by the value of `ANOTHER` variable (defined in the same env file).
### 🔹 `expand` Default: `false`
If `true`, "expands" variables:
```dotenv
VAR_1=aaa
VAR_2=${VAR_1}_bbb
```
Will lead to following exported variables: `VAR1 = aaa`, `VAR2 = aaa_bbb`.

### 🔸 `expandWithJobEnv` Default: `false`
"Expands" variables considering step (job) env variables if equals `true` (in addition to variables defined in the same env file).
It means, `${GITHUB_RUN_ATTEMPT}` in variable value will be substituted by the value of `$GITHUB_RUN_ATTEMPT` job env variable.
### 🔹 `expandWithJobEnv` Default: `false`
If `true`, "expands" variables considering step (job) env variables (in addition to variables defined in the same env file).
It means, `${GITHUB_RUN_ATTEMPT}` in a variable value will be substituted by the value of `$GITHUB_RUN_ATTEMPT` job env variable.

### 🔸 `export` Default: `true`
### 🔹 `export` Default: `true`
Export variables to a job environment. If `false`, all variables will be set as an action
outputs instead.

## Outputs

If `export` is `false` then has an individual output for each variable from env file.
If `export` is `false` then has an individual output for each variable from env file (where output name equals variable name).
2 changes: 1 addition & 1 deletion action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,4 +21,4 @@ inputs:
default: 'true'
runs:
using: 'node16'
main: 'dist/index.js'
main: 'dist/index.js'
Loading

0 comments on commit 8f935ca

Please sign in to comment.