Skip to content

afflicted-cat/create-dotenv-action

Use this GitHub action with your project
Add this Action to an existing workflow or create a new one
View on Marketplace

Repository files navigation

Create Dotenv Action

Tests

The action looks for env variables starting with ^ and creates an env file, writing the found variables into it, discarding the ^ character

Usage

name: Build

on: push

jobs:
  build:
    runs-on: ubuntu-latest
    steps:
      - uses: actions/checkout@v2

      - name: Create .env.production
        uses: weyheyhey/create-dotenv-action@v1
        with:
          wildecard: "^"
          filename: ".env.production"
        env:
          ^ENV_ONE: value-one
          ^ENV_TWO: ${{ secrets.ENV_TWO }}

Options

filename

  • Default: ".env"

Name of the generated file. The file is created relative to GITHUB_WORKSPACE (inside the GitHub workspace directory).

with:
  filename: ".env.production"

wildecard

  • Default: "^"

The key that env variables must start with to get into the .env file.

with:
  wildecard: "PUBLIC_"
  env:
    PUBLIC_ENV_ONE: value-one
    PUBLIC_ENV_TWO: ${{ secrets.ENV_TWO }}

When writing variables to a .env file, this value will be discarded. For example, for the previous config, the following file will be generated:

ENV_ONE=value-one
ENV_TWO=value-two

About

Easy way to create .env file for github actions

Resources

License

Stars

Watchers

Forks

Packages

No packages published