Skip to content
sliders

GitHub Action

next-env

v1.2.0 Latest version

next-env

sliders

next-env

Read .env.[development|test|production][.local] files in Next.js projects and add variables as secrets to GITHUB_ENV

Installation

Copy and paste the following snippet into your .yml file.

              

- name: next-env

uses: natterstefan/action-next-env@v1.2.0

Learn more about this action in natterstefan/action-next-env

Choose a version

action-next-env

GitHub Action to read .env.[development|test|production][.local] files in Next.js (but also non Next.js) projects and add variables as secrets to GITHUB_ENV.

Usage

# .env file
HELLO="WORLD"
- name: Load .env file
  uses: natterstefan/action-next-env@v1
  with:
    path: custom/path/to/folder/with/env # optional, default: .
    environment: development

- name: Some other action
  run: |
    echo "HELLO Variable: ${{ env.HELLO }}"

or when using the action in a monorepo setup (but also applicable in other cases):

- name: Load .env file
  uses: natterstefan/action-next-env@v1
  with:
    working-directory: 'packages/app'
    path: custom/path/to/folder/with/env # optional, default: .
    environment: development

- name: Some other action
  run: |
    echo "HELLO Variable: ${{ env.HELLO }}"

Development

First, you'll need to have a reasonably modern version of node handy. This won't work with versions older than 16, for instance.

Install the dependencies

npm install

Build the package for distribution

# package the source files
npm run package
# afterward create a release for instance with one of the release GitHub actions

Run the tests

npm test

LICENSE

MIT

Misc. Ressources

Similar actions

Contributors ✨

Thanks goes to these wonderful people (emoji key):


Stefan Natter

🤔 💻 📖

This project follows the all-contributors specification. Contributions of any kind welcome!