ENV Service

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 .hxkey file for decrypting the environment secrets.

Parameters

  • hxKeyFile (required): The contents of the .hxkey file. The contents of the .hxkey file. 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 .env files on the file system.
    • variables: Exports the secrets as environment variables.
  • variablePrefix (optional): If using the variables option, adds a prefix to the exported environment variables.
  • path (optional): Specifies the path where the source code is located, defaults to GITHUB_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
      variables

What’s Next