Skip to content

Commit

Permalink
script to move publish tokens to GCP secret manager
Browse files Browse the repository at this point in the history
Signed-off-by: Bob Callaway <[email protected]>
  • Loading branch information
bobcallaway committed Feb 3, 2025
1 parent 188fee8 commit 298e6c1
Showing 1 changed file with 37 additions and 0 deletions.
37 changes: 37 additions & 0 deletions .github/workflows/migrate-secrets.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
name: Store Publish Tokens in GCP Secret Manager

on:
workflow_dispatch:

permissions: {}

jobs:
store-secrets:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write

steps:
- name: Authenticate to Google Cloud
uses: google-github-actions/auth@6fc4af4b145ae7821d527454aa9bd537d1f2dc5f # v0.8.1
with:
workload_identity_provider: projects/306323169285/locations/global/workloadIdentityPools/github-actions-pool/providers/github-actions-provider
service_account: [email protected]

- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@6189d56e4096ee891640bb02ac264be376592d6a # v2.1.2
with:
project_id: 'sigstore-secrets'

- name: Store secrets in Secret Manager
env:
NPM_PUBLISH_TOKEN: ${{ secrets.NPM_PUBLISH_TOKEN }}
CARGO_REGISTRY_TOKEN: ${{ secrets.CARGO_REGISTRY_TOKEN }}
RUBYGEMS_AUTH_TOKEN: ${{ secrets.RUBYGEMS_AUTH_TOKEN }}
run: |
printenv NPM_PUBLISH_TOKEN | gcloud secrets create protobuf-specs-npm-publish-token --replication-policy="automatic" --data-file=-
printenv CARGO_REGISTRY_TOKEN | gcloud secrets create protobuf-specs-cargo-registry-token --replication-policy="automatic" --data-file=-
printenv RUBYGEMS_AUTH_TOKEN | gcloud secrets create protobuf-specs-rubygems-auth-token --replication-policy="automatic" --data-file=-

0 comments on commit 298e6c1

Please sign in to comment.