Skip to content

Authenticate the deploy to Google Cloud with GitHub's OIDC token - #38

Merged
ericmj merged 1 commit into
mainfrom
gcp-oidc
Oct 15, 2026
Merged

ericmj merged 1 commit into
mainfrom
gcp-oidc

Conversation

@ericmj

@ericmj ericmj commented Oct 15, 2026

Copy link
Copy Markdown
Member

The deploy job authenticates to Google Cloud as hexdocs-search through GitHub's OIDC token and workload identity federation, instead of the service account key in the GCP_SA_KEY environment secret (prod 82b890fd, staging ebbe2fee, created 2026-07-14). The job gets id-token: write to request the token and contents: read for the checkout.

GCP_WORKLOAD_IDENTITY_PROVIDER and GCP_SERVICE_ACCOUNT come from the staging and prod environments, which hexpm-ops manages. The hexpm-ops change binds hexdocs-search@hexpm-<env> to the subject repo:hexpm/hexdocs-search:environment:<env> and limits each environment to the branch of the same name, so only a push to staging or prod can deploy.

Merging doesn't deploy; the workflow runs on pushes to staging and prod, and those should only get this after the hexpm-ops change is applied. Once both environments have deployed with it, hexpm-ops deletes the keys and GCP_SA_KEY.

The deploy job gets a token for hexdocs-search through workload identity
federation instead of the service account key in GCP_SA_KEY, which can
then be deleted. hexpm-ops sets GCP_WORKLOAD_IDENTITY_PROVIDER and
GCP_SERVICE_ACCOUNT in the staging and prod environments and binds the
service account to each environment's subject.
@ericmj
ericmj merged commit 3a9e34c into main Oct 15, 2026
2 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant