From a8450b5a0243481fe3bda7abb39ee62508d25ad2 Mon Sep 17 00:00:00 2001 From: Randall Keur Date: Tue, 29 Oct 2024 17:19:18 -0400 Subject: [PATCH] extract work to test --- .github/workflows/retrieve_secrets.yaml | 28 +++++++++++++++++++++++++ .github/workflows/sdk_generation.yaml | 23 ++++---------------- 2 files changed, 32 insertions(+), 19 deletions(-) create mode 100644 .github/workflows/retrieve_secrets.yaml diff --git a/.github/workflows/retrieve_secrets.yaml b/.github/workflows/retrieve_secrets.yaml new file mode 100644 index 0000000..c786eac --- /dev/null +++ b/.github/workflows/retrieve_secrets.yaml @@ -0,0 +1,28 @@ +name: Retrieve Secrets + +on: + workflow_call: + inputs: + environment: + required: true + type: string + +jobs: + retrieve-secrets: + runs-on: ubuntu-latest + steps: + - name: Authenticate with AWS + uses: goshippo/shippo-action-workflows/.github/actions/aws_auth@v1.1.0 + with: + environment: ${{ inputs.environment }} + oidc-name: shippo-php-sdk-pipeline + login-to-ecr: false + + - name: Get Speakeasy Secrets Manager + id: get-secrets + uses: aws-actions/aws-secretsmanager-get-secrets@v2 + with: + secret-ids: | + dev-main-speakeasy-api-key + name-transformation: uppercase + parse-json-secrets: true diff --git a/.github/workflows/sdk_generation.yaml b/.github/workflows/sdk_generation.yaml index 852410d..52cfae6 100644 --- a/.github/workflows/sdk_generation.yaml +++ b/.github/workflows/sdk_generation.yaml @@ -18,23 +18,9 @@ on: jobs: gather-secrets: - runs-on: ubuntu-latest - steps: - - name: Authenticate with AWS - uses: goshippo/shippo-action-workflows/.github/actions/aws_auth@v1.1.0 - with: - environment: dev-main - oidc-name: shippo-php-sdk-pipeline - login-to-ecr: false - - - name: Get Speakeasy Secrets Manager - id: get-secrets - uses: aws-actions/aws-secretsmanager-get-secrets@v2 - with: - secret-ids: | - dev-main-speakeasy-api-key - name-transformation: uppercase - parse-json-secrets: true + uses: ./.github/workflows/secrets_retrieval.yaml + with: + environment: dev-main speakeasy_generate: needs: gather-secrets @@ -48,5 +34,4 @@ jobs: speakeasy_version: latest env: github_access_token: ${{ secrets.GITHUB_TOKEN }} - speakeasy_api_key: ${{ steps.get-secrets.outputs.DEV_MAIN_SPEAKEASY_API_KEY_PHP_API_KEY }} # Reference the secret directly - + speakeasy_api_key: ${{ jobs.gather-secrets.outputs.get-secrets.DEV_MAIN_SPEAKEASY_API_KEY_PHP_API_KEY }} # Reference the output directly