Skip to content

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.

License

Notifications You must be signed in to change notification settings

natterstefan/action-next-env

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

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

26 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

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 20, 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!