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.
# .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 }}"
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
- xom9ikk/dotenv: GitHub Action to read .env file and add variables to GITHUB_ENV
- falti/dotenv-action: Provide common parameters via .env file
Thanks goes to these wonderful people (emoji key):
Stefan Natter 🤔 💻 📖 |
This project follows the all-contributors specification. Contributions of any kind welcome!