Skip to content

Commit 4476213

Browse files
Fetch Docker secrets from AWS
1 parent 15ef9a5 commit 4476213

2 files changed

Lines changed: 21 additions & 6 deletions

File tree

.github/workflows/github-actions.yml

Lines changed: 20 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
# This workflow will build the project, run integration tests, and release.
2-
# Because secrets are not available on external forks, this job is expected to fail
3-
# on external pull requests.
2+
# Secret-backed jobs fetch credentials from AWS Secrets Manager using GitHub OIDC.
43

54
name: Build, Check, Publish
65

@@ -13,15 +12,31 @@ on:
1312
jobs:
1413
build:
1514
runs-on: ubuntu-latest
15+
permissions:
16+
id-token: write
17+
contents: read
1618
steps:
1719
- name: Checkout Repo
1820
uses: actions/checkout@v3
1921

22+
- name: Configure AWS credentials for Docker Hub secrets (OIDC)
23+
if: github.event_name != 'pull_request'
24+
uses: aws-actions/configure-aws-credentials@v6
25+
with:
26+
role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-node-branch-main
27+
aws-region: us-west-2
28+
29+
- name: Get Docker Hub secrets from AWS Secrets Manager
30+
if: github.event_name != 'pull_request'
31+
uses: aws-actions/aws-secretsmanager-get-secrets@v3
32+
with:
33+
secret-ids: |
34+
DOCKER_USERNAME,github-actions/hellosign/shared/docker-username
35+
DOCKER_TOKEN,github-actions/hellosign/shared/docker-token
36+
parse-json-secrets: false
37+
2038
- name: Build SDK
2139
run: ./run-build
22-
env:
23-
DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}}
24-
DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}}
2540

2641
- name: Ensure no changes in Generated Code
2742
run: ./bin/check-clean-git-status

run-build

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@ set -e
77
DIR=$(cd `dirname $0` && pwd)
88
WORKING_DIR="/app/javascript"
99

10-
if [[ -n "$GITHUB_ACTIONS" ]]; then
10+
if [[ -n "$GITHUB_ACTIONS" && -n "${DOCKER_USERNAME:-}" && -n "${DOCKER_TOKEN:-}" ]]; then
1111
printf "\nLogging in to docker.com ...\n"
1212
echo "${DOCKER_TOKEN}" | docker login -u "${DOCKER_USERNAME}" --password-stdin
1313
fi

0 commit comments

Comments
 (0)