ENV with Github Actions
This action retrieves secrets for the specified environment, decrypts them using the provided profile's key file, and outputs them either as standard .env files or exports them as environment variables.
Prerequisites
Before using the ENV service, ensure that:
- The Setup hx Command Line action has been run.
- You have access to the
.hxkeyfile for decrypting the environment secrets.
Parameters
hxKeyFile(required): The contents of the.hxkeyfile. The contents of the.hxkeyfile. This will NOT be sent to Hyphen and will only be used within the action container.environment(required): The ENV environment to pull (e.g.,production,staging).outputs(optional): Specifies how the secrets should be provided:files(default): Writes the secrets to standard.envfiles on the file system.variables: Exports the secrets as environment variables.
variablePrefix(optional): If using thevariablesoption, adds a prefix to the exported environment variables.path(optional): Specifies the path where the source code is located, defaults toGITHUB_WORKSPACE.
Example Usage
- name: Checkout
id: checkout
uses: actions/checkout@v4
- name: setup hx CLI
id: setup
uses: Hyphen/setup-hx-action@v1
with:
apiKey: ${{ secrets.HYPHEN_API_KEY }}
- name: Pull ENV
id: pull-env
uses: Hyphen/env-action@v1
with:
hxKeyFile: ${{ secrets.HYPHEN_KEY_FILE }}
environment: production
outputs: |-
files
variablesUpdated about 1 month ago
What’s Next
