Skip to content

Use either DEV or PROD environment variables based on iProd boolean variable value. Sets the env variable scope for whole runner.

License

Notifications You must be signed in to change notification settings

arpitremarkable/prod-env-variables

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

16 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Production Environment Variables On Flag

Use either DEV or PROD environment variables based on iProd boolean variable value. Sets the env variable scope for whole runner.

Usage

Inputs

  • keys: The environment variables to search replace with production values.
  • isProd: Boolean variable indicating whether to use Production credentials or not.

Example Workflow

name: Do Stuff
on: push

jobs:
  doIt:
    name: Do It
    runs-on: ubuntu-latest

    steps:
    - uses: actions/checkout@v2

    - uses: arpitremarkable/prod-env-variables@v2
      with:
        isProd: ${{ github.ref == 'refs/heads/master' }}
        keys: |
          API_URL
          GOOGLE_ANALYTICS
      env:
        API_URL: https://devapi.example.com
        API_URL_PROD: https://api.example.com
        GOOGLE_ANALYTICS_PROD: my_analytics_key

    - name: Echo 1
      run: echo $API_URL
    - name: Echo 2
      run: echo $GOOGLE_ANALYTICS

With the above workflow, on the isProd == true, API_URL would be https://api.example.com while GOOGLE_ANALYTICS would be my_analytics_key. On any other falsy value, API_URL would be https://devapi.example.com while GOOGLE_ANALYTICS would be empty.

About

Use either DEV or PROD environment variables based on iProd boolean variable value. Sets the env variable scope for whole runner.

Resources

License

Stars

Watchers

Forks

Packages

 
 
 

Languages

  • JavaScript 100.0%