https://github.com/natterstefan/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.
https://github.com/natterstefan/action-next-env
dotenv dotenv-parser github-action nextjs
Last synced: 9 months ago
JSON representation
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.
- Host: GitHub
- URL: https://github.com/natterstefan/action-next-env
- Owner: natterstefan
- License: mit
- Created: 2022-08-12T06:32:45.000Z (over 3 years ago)
- Default Branch: main
- Last Pushed: 2024-07-26T06:47:41.000Z (over 1 year ago)
- Last Synced: 2025-05-25T00:29:10.661Z (11 months ago)
- Topics: dotenv, dotenv-parser, github-action, nextjs
- Language: TypeScript
- Homepage: https://github.com/marketplace/actions/next-env
- Size: 1.07 MB
- Stars: 11
- Watchers: 1
- Forks: 0
- Open Issues: 11
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- Funding: .github/FUNDING.yml
- License: LICENSE
- Codeowners: .github/CODEOWNERS
Awesome Lists containing this project
README
# 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
```text
# .env file
HELLO="WORLD"
```
```yaml
- 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):
```yaml
- 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
```bash
npm install
```
Build the package for distribution
```bash
# package the source files
npm run package
# afterward create a release for instance with one of the release GitHub actions
```
Run the tests
```bash
npm test
```
## LICENSE
[MIT](LICENSE)
## Misc. Ressources
- [@next/env - npm](https://www.npmjs.com/package/@next/env)
- [dotenv - npm](https://www.npmjs.com/package/dotenv)
- [dotenv-expand - npm](https://www.npmjs.com/package/dotenv-expand)
- [example versioning documentation](https://github.com/actions/toolkit/blob/master/docs/action-versioning.md)
## Similar actions
- [xom9ikk/dotenv: GitHub Action to read .env file and add variables to GITHUB_ENV](https://github.com/xom9ikk/dotenv)
- [falti/dotenv-action: Provide common parameters via .env file](https://github.com/falti/dotenv-action)
## Contributors ✨
Thanks goes to these wonderful people ([emoji key](https://allcontributors.org/docs/en/emoji-key)):
This project follows the [all-contributors](https://github.com/all-contributors/all-contributors) specification. Contributions of any kind welcome!