• Concept
  • Version · 6.0
  • Create

Secure setup using GitHub Actions secrets

Last updated: September 29, 2026

If GitHub Actions runs your deployments, store the connection details as environment secrets rather than repository secrets. A workflow targeting QA then cannot read production credentials, which is the property you want when the same workflow file serves every environment.

1. Create an environment for each target

In your repository, go to Settings > Environments and create one environment per deployment target.

The Environments page in GitHub repository settings, with one environment created for each deployment target: PROD, QA, and DEV.

2. Add the connection secrets to each environment

In each environment, add a secret for the URL, the username, and the password, named to match the Liquibase environment variables:

  • LIQUIBASE_COMMAND_URL

  • LIQUIBASE_COMMAND_USERNAME

  • LIQUIBASE_COMMAND_PASSWORD

The New secret form in GitHub Actions, with the name set to LIQUIBASE_COMMAND_URL and the value set to a JDBC connection string.

Naming them exactly as the environment variables means the workflow does not have to translate anything, and there is one less place for a typo to hide.

Once all three exist in all three environments, the secrets list shows nine entries:

The Actions secrets and variables page listing environment secrets. Each of LIQUIBASE_COMMAND_URL, LIQUIBASE_COMMAND_USERNAME, and LIQUIBASE_COMMAND_PASSWORD is stored separately for the DEV, QA, and PROD environments.

3. Select the environment in the workflow

Set environment: on the job, and map the secrets to the Liquibase variables:

loading

secrets.X resolves against the environment named in environment:, so the same workflow deploys to a different database purely by changing that one value, usually from a matrix or an input.

Why this is worth more than secret storage

Environments are also where GitHub keeps protection rules. Requiring a named reviewer before a job in the PROD environment runs gives you a human approval step that is enforced by the pipeline rather than by convention.

That is usually the cleanest way to satisfy an auditor who expects a person to sign off on a production change, because the approval is recorded against the deployment rather than in a ticket somewhere else. See Change authorization best practices.

Where to go next