diff --git a/sdks/dotnet/.github/workflows/github-actions.yml b/sdks/dotnet/.github/workflows/github-actions.yml index d906a4852..fc7e41dee 100644 --- a/sdks/dotnet/.github/workflows/github-actions.yml +++ b/sdks/dotnet/.github/workflows/github-actions.yml @@ -1,6 +1,5 @@ # This workflow will build the project, run integration tests, and release. -# Because secrets are not available on external forks, this job is expected to fail -# on external pull requests. +# Secret-backed jobs fetch credentials from AWS Secrets Manager using GitHub OIDC. name: Build, Check, Publish @@ -13,22 +12,44 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Configure AWS credentials for Docker Hub secrets (OIDC) + if: github.event_name != 'pull_request' + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-dotnet-branch-main + aws-region: us-west-2 + + - name: Get Docker Hub secrets from AWS Secrets Manager + if: github.event_name != 'pull_request' + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + DOCKER_USERNAME,github-actions/hellosign/shared/docker-username + DOCKER_TOKEN,github-actions/hellosign/shared/docker-token + parse-json-secrets: false + - name: Build SDK run: ./run-build - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}} - name: Ensure no changes in Generated Code run: ./bin/check-clean-git-status publish: runs-on: ubuntu-latest - if: github.repository == 'hellosign/dropbox-sign-dotnet' + permissions: + contents: read + id-token: write + if: >- + github.repository == 'hellosign/dropbox-sign-dotnet' + && github.ref == 'refs/heads/main' + && github.event_name != 'pull_request' needs: [ build ] env: BUILD_CONFIG: 'Release' @@ -54,13 +75,18 @@ jobs: - name: Run pack run: dotnet pack --configuration ${BUILD_CONFIG} ${SOLUTION}.sln - # This runs on merging to "main" branch - # Builds and publishes package to nuget.org + - name: NuGet login with trusted publishing + uses: NuGet/login@v1 + id: nuget-login + with: + user: HelloSign + - name: Publish to nuget - if: github.ref == 'refs/heads/main' && github.event_name != 'pull_request' - run: dotnet nuget push src/${SOLUTION}/bin/Release/*.nupkg -k ${NUGET_API_KEY} -s https://api.nuget.org/v3/index.json - env: - NUGET_API_KEY: ${{ secrets.NUGET_API_KEY }} + run: >- + dotnet nuget push + src/${SOLUTION}/bin/Release/*.nupkg + --api-key ${{ steps.nuget-login.outputs.NUGET_API_KEY }} + --source https://api.nuget.org/v3/index.json # This job runs on merging to "main" branch # Creates a new tag using the value in the VERSION file diff --git a/sdks/java-v1/.github/workflows/close-and-release-repository.yml b/sdks/java-v1/.github/workflows/close-and-release-repository.yml index 8f07b7ed9..4b08ef95e 100644 --- a/sdks/java-v1/.github/workflows/close-and-release-repository.yml +++ b/sdks/java-v1/.github/workflows/close-and-release-repository.yml @@ -8,7 +8,13 @@ on: jobs: closeAndReleaseRepository: + if: >- + github.repository == 'hellosign/dropbox-sign-java' + && github.ref == 'refs/heads/v1' runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout uses: actions/checkout@v3 @@ -19,10 +25,26 @@ jobs: distribution: 'zulu' java-version: 11 + - name: Configure AWS credentials for Maven secrets (OIDC) + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::521590706193:role/oidc-github-hellosign-dropbox-sign-java-branch-v1 + aws-region: us-west-2 + + - name: Get Maven Central secrets from AWS Secrets Manager + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + SONATYPE_USERNAME,sdk-release-maven-central-token-username + SONATYPE_PASSWORD,sdk-release-maven-central-token-password + SIGNING_KEY,sdk-release-signing-key + SIGNING_PASSWORD,sdk-release-signing-password + parse-json-secrets: false + - name: Publish Release to Maven Central run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ env.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ env.SIGNING_PASSWORD }} diff --git a/sdks/java-v1/.github/workflows/github-actions.yml b/sdks/java-v1/.github/workflows/github-actions.yml index 8a5616e8d..8c3ef74c5 100644 --- a/sdks/java-v1/.github/workflows/github-actions.yml +++ b/sdks/java-v1/.github/workflows/github-actions.yml @@ -1,6 +1,5 @@ # This workflow will build the project, run integration tests, and release. -# Because secrets are not available on external forks, this job is expected to fail -# on external pull requests. +# Secret-backed jobs fetch credentials from AWS Secrets Manager using GitHub OIDC. name: Build, Check, Publish @@ -15,15 +14,31 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Configure AWS credentials for Docker Hub secrets (OIDC) + if: github.event_name != 'pull_request' + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-java-branch-v1 + aws-region: us-west-2 + + - name: Get Docker Hub secrets from AWS Secrets Manager + if: github.event_name != 'pull_request' + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + DOCKER_USERNAME,github-actions/hellosign/shared/docker-username + DOCKER_TOKEN,github-actions/hellosign/shared/docker-token + parse-json-secrets: false + - name: Build SDK run: ./run-build - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}} - name: Ensure no changes in Generated Code run: ./bin/check-clean-git-status @@ -37,6 +52,9 @@ jobs: && github.ref == 'refs/heads/v1' && github.event_name != 'pull_request' needs: [ build ] + permissions: + id-token: write + contents: read steps: - name: Checkout uses: actions/checkout@v3 @@ -50,23 +68,39 @@ jobs: - name: Retrieve version run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV + - name: Configure AWS credentials for Maven secrets (OIDC) + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::521590706193:role/oidc-github-hellosign-dropbox-sign-java-branch-v1 + aws-region: us-west-2 + + - name: Get Maven Central secrets from AWS Secrets Manager + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + SONATYPE_USERNAME,sdk-release-maven-central-token-username + SONATYPE_PASSWORD,sdk-release-maven-central-token-password + SIGNING_KEY,sdk-release-signing-key + SIGNING_PASSWORD,sdk-release-signing-password + parse-json-secrets: false + - name: Publish to Maven Central run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace if: "!endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ env.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ env.SIGNING_PASSWORD }} - name: Publish Snapshot run: ./gradlew publishToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace if: "endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ env.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ env.SIGNING_PASSWORD }} # This job runs on merging to "v1" branch # Creates a new tag using the value in the VERSION file diff --git a/sdks/java-v2/.github/workflows/close-and-release-repository.yml b/sdks/java-v2/.github/workflows/close-and-release-repository.yml index 8f07b7ed9..95241bcfe 100644 --- a/sdks/java-v2/.github/workflows/close-and-release-repository.yml +++ b/sdks/java-v2/.github/workflows/close-and-release-repository.yml @@ -8,7 +8,13 @@ on: jobs: closeAndReleaseRepository: + if: >- + github.repository == 'hellosign/dropbox-sign-java' + && github.ref == 'refs/heads/main' runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout uses: actions/checkout@v3 @@ -19,10 +25,26 @@ jobs: distribution: 'zulu' java-version: 11 + - name: Configure AWS credentials for Maven secrets (OIDC) + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::521590706193:role/oidc-github-hellosign-dropbox-sign-java-branch-main + aws-region: us-west-2 + + - name: Get Maven Central secrets from AWS Secrets Manager + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + SONATYPE_USERNAME,sdk-release-maven-central-token-username + SONATYPE_PASSWORD,sdk-release-maven-central-token-password + SIGNING_KEY,sdk-release-signing-key + SIGNING_PASSWORD,sdk-release-signing-password + parse-json-secrets: false + - name: Publish Release to Maven Central run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ env.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ env.SIGNING_PASSWORD }} diff --git a/sdks/java-v2/.github/workflows/github-actions.yml b/sdks/java-v2/.github/workflows/github-actions.yml index fb81028a6..2728b34aa 100644 --- a/sdks/java-v2/.github/workflows/github-actions.yml +++ b/sdks/java-v2/.github/workflows/github-actions.yml @@ -1,6 +1,5 @@ # This workflow will build the project, run integration tests, and release. -# Because secrets are not available on external forks, this job is expected to fail -# on external pull requests. +# Secret-backed jobs fetch credentials from AWS Secrets Manager using GitHub OIDC. name: Build, Check, Publish @@ -15,15 +14,31 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Configure AWS credentials for Docker Hub secrets (OIDC) + if: github.event_name != 'pull_request' + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-java-branch-main + aws-region: us-west-2 + + - name: Get Docker Hub secrets from AWS Secrets Manager + if: github.event_name != 'pull_request' + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + DOCKER_USERNAME,github-actions/hellosign/shared/docker-username + DOCKER_TOKEN,github-actions/hellosign/shared/docker-token + parse-json-secrets: false + - name: Build SDK run: ./run-build - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}} - name: Ensure no changes in Generated Code run: ./bin/check-clean-git-status @@ -37,6 +52,9 @@ jobs: && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' needs: [ build ] + permissions: + id-token: write + contents: read steps: - name: Checkout uses: actions/checkout@v3 @@ -50,23 +68,39 @@ jobs: - name: Retrieve version run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV + - name: Configure AWS credentials for Maven secrets (OIDC) + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::521590706193:role/oidc-github-hellosign-dropbox-sign-java-branch-main + aws-region: us-west-2 + + - name: Get Maven Central secrets from AWS Secrets Manager + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + SONATYPE_USERNAME,sdk-release-maven-central-token-username + SONATYPE_PASSWORD,sdk-release-maven-central-token-password + SIGNING_KEY,sdk-release-signing-key + SIGNING_PASSWORD,sdk-release-signing-password + parse-json-secrets: false + - name: Publish to Maven Central run: ./gradlew publishAndReleaseToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace if: "!endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ env.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ env.SIGNING_PASSWORD }} - name: Publish Snapshot run: ./gradlew publishToMavenCentral --no-daemon --no-parallel --no-configuration-cache --stacktrace if: "endsWith(env.PACKAGE_VERSION, '-SNAPSHOT')" env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_KEY }} - ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_PASSWORD }} + ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ env.SONATYPE_USERNAME }} + ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ env.SONATYPE_PASSWORD }} + ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ env.SIGNING_KEY }} + ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ env.SIGNING_PASSWORD }} # This job runs on merging to "main" branch # Creates a new tag using the value in the VERSION file diff --git a/sdks/node/.github/workflows/github-actions.yml b/sdks/node/.github/workflows/github-actions.yml index f9f3ba3a8..fa719de2e 100644 --- a/sdks/node/.github/workflows/github-actions.yml +++ b/sdks/node/.github/workflows/github-actions.yml @@ -1,6 +1,5 @@ # This workflow will build the project, run integration tests, and release. -# Because secrets are not available on external forks, this job is expected to fail -# on external pull requests. +# Secret-backed jobs fetch credentials from AWS Secrets Manager using GitHub OIDC. name: Build, Check, Publish @@ -13,15 +12,31 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Configure AWS credentials for Docker Hub secrets (OIDC) + if: github.event_name != 'pull_request' + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-node-branch-main + aws-region: us-west-2 + + - name: Get Docker Hub secrets from AWS Secrets Manager + if: github.event_name != 'pull_request' + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + DOCKER_USERNAME,github-actions/hellosign/shared/docker-username + DOCKER_TOKEN,github-actions/hellosign/shared/docker-token + parse-json-secrets: false + - name: Build SDK run: ./run-build - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}} - name: Ensure no changes in Generated Code run: ./bin/check-clean-git-status @@ -47,13 +62,14 @@ jobs: - run: npm ci - run: npm publish --access=public --dry-run - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }} # This job runs on merging to "main" branch # Builds and publishes gem publish-prod: runs-on: ubuntu-latest + permissions: + contents: read + id-token: write if: >- github.repository == 'hellosign/dropbox-sign-node' && github.ref == 'refs/heads/main' @@ -63,16 +79,19 @@ jobs: - name: Checkout uses: actions/checkout@v3 - - uses: actions/setup-node@v3 + - name: Use Node.js 24 for trusted publishing + uses: actions/setup-node@v4 with: - node-version: '16.x' + node-version: '24.x' registry-url: 'https://registry.npmjs.org' - run: npm ci - - run: npm publish --access=public - env: - NODE_AUTH_TOKEN: ${{ secrets.NPM_API_KEY }} + - name: Use npm with trusted publishing support + run: npm install --global npm@11.19.1 + + - name: Publish package with trusted publishing + run: npm publish --access=public # This job runs on merging to "main" branch # Creates a new tag using the value in the VERSION file diff --git a/sdks/php/.github/workflows/github-actions.yml b/sdks/php/.github/workflows/github-actions.yml index 5bc007baf..3e6ada091 100644 --- a/sdks/php/.github/workflows/github-actions.yml +++ b/sdks/php/.github/workflows/github-actions.yml @@ -1,6 +1,5 @@ # This workflow will build the project, run integration tests, and release. -# Because secrets are not available on external forks, this job is expected to fail -# on external pull requests. +# Secret-backed jobs fetch credentials from AWS Secrets Manager using GitHub OIDC. name: Build, Check, Publish @@ -13,15 +12,31 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Configure AWS credentials for Docker Hub secrets (OIDC) + if: github.event_name != 'pull_request' + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-php-branch-main + aws-region: us-west-2 + + - name: Get Docker Hub secrets from AWS Secrets Manager + if: github.event_name != 'pull_request' + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + DOCKER_USERNAME,github-actions/hellosign/shared/docker-username + DOCKER_TOKEN,github-actions/hellosign/shared/docker-token + parse-json-secrets: false + - name: Build SDK run: ./run-build - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}} - name: Ensure no changes in Generated Code run: ./bin/check-clean-git-status diff --git a/sdks/python/.github/workflows/github-actions.yml b/sdks/python/.github/workflows/github-actions.yml index d89e40a59..5e86fa624 100644 --- a/sdks/python/.github/workflows/github-actions.yml +++ b/sdks/python/.github/workflows/github-actions.yml @@ -1,9 +1,6 @@ # This workflow will build the project, run integration tests, and release. -# Because secrets are not available on external forks, this job is expected to fail -# on external pull requests. - -# publishing instructions from -# https://packaging.python.org/en/latest/guides/publishing-package-distribution-releases-using-github-actions-ci-cd-workflows/ +# Secret-backed jobs fetch credentials from AWS Secrets Manager using GitHub OIDC. +# PyPI uploads use trusted publishing (GitHub OIDC), not API tokens. name: Build, Check, Publish @@ -16,56 +13,42 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Configure AWS credentials for Docker Hub secrets (OIDC) + if: github.event_name != 'pull_request' + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-python-branch-main + aws-region: us-west-2 + + - name: Get Docker Hub secrets from AWS Secrets Manager + if: github.event_name != 'pull_request' + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + DOCKER_USERNAME,github-actions/hellosign/shared/docker-username + DOCKER_TOKEN,github-actions/hellosign/shared/docker-token + parse-json-secrets: false + - name: Build SDK run: ./run-build - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}} - name: Ensure no changes in Generated Code run: ./bin/check-clean-git-status - # This job runs on pull requests - # Publishes to test.pypi.org, useful as a dry run - # Step still passes even if package version was already uploaded - publish-test: - runs-on: ubuntu-latest - if: >- - github.repository == 'hellosign/dropbox-sign-python' - && github.ref != 'refs/heads/main' - && github.event_name == 'pull_request' - needs: [ build ] - steps: - - name: Checkout - uses: actions/checkout@v3 - - - name: Set up Python 3.10 - uses: actions/setup-python@v3 - with: - python-version: "3.10" - - - name: Install pypa/build - run: python -m pip install build --user - - - name: Build a binary wheel and a source tarball - run: python -m build --sdist --wheel --outdir dist/ . - - - name: Publish distribution to Test PyPI - uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_TEST_API_KEY }} - repository_url: https://test.pypi.org/legacy/ - skip_existing: true - verbose: true - # This job runs on merging to "main" branch - # Builds and publishes package to pypi.org + # Builds and publishes package to pypi.org with trusted publishing publish-prod: runs-on: ubuntu-latest + permissions: + contents: read + id-token: write if: >- github.repository == 'hellosign/dropbox-sign-python' && github.ref == 'refs/heads/main' @@ -86,10 +69,8 @@ jobs: - name: Build a binary wheel and a source tarball run: python -m build --sdist --wheel --outdir dist/ . - - name: Publish distribution to PyPI + - name: Publish package with trusted publishing uses: pypa/gh-action-pypi-publish@release/v1 - with: - password: ${{ secrets.PYPI_API_KEY }} # This job runs on merging to "main" branch # Creates a new tag using the value in the VERSION file diff --git a/sdks/ruby/.github/workflows/github-actions.yml b/sdks/ruby/.github/workflows/github-actions.yml index 0c9590e51..d43f0d2e9 100644 --- a/sdks/ruby/.github/workflows/github-actions.yml +++ b/sdks/ruby/.github/workflows/github-actions.yml @@ -1,6 +1,5 @@ # This workflow will build the project, run integration tests, and release. -# Because secrets are not available on external forks, this job is expected to fail -# on external pull requests. +# Secret-backed jobs fetch credentials from AWS Secrets Manager using GitHub OIDC. name: Build, Check, Publish @@ -13,15 +12,31 @@ on: jobs: build: runs-on: ubuntu-latest + permissions: + id-token: write + contents: read steps: - name: Checkout Repo uses: actions/checkout@v3 + - name: Configure AWS credentials for Docker Hub secrets (OIDC) + if: github.event_name != 'pull_request' + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-ruby-branch-main + aws-region: us-west-2 + + - name: Get Docker Hub secrets from AWS Secrets Manager + if: github.event_name != 'pull_request' + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + DOCKER_USERNAME,github-actions/hellosign/shared/docker-username + DOCKER_TOKEN,github-actions/hellosign/shared/docker-token + parse-json-secrets: false + - name: Build SDK run: ./run-build - env: - DOCKER_USERNAME: ${{secrets.DOCKER_USERNAME}} - DOCKER_TOKEN: ${{secrets.DOCKER_TOKEN}} - name: Ensure no changes in Generated Code run: ./bin/check-clean-git-status @@ -35,14 +50,30 @@ jobs: && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' needs: [ build ] + permissions: + id-token: write + contents: read steps: - name: Checkout uses: actions/checkout@v3 + - name: Configure AWS credentials for RubyGems secrets (OIDC) + uses: aws-actions/configure-aws-credentials@v6 + with: + role-to-assume: arn:aws:iam::301904545275:role/oidc-github-hellosign-dropbox-sign-ruby-branch-main + aws-region: us-west-2 + + - name: Get RubyGems secrets from AWS Secrets Manager + uses: aws-actions/aws-secretsmanager-get-secrets@v3 + with: + secret-ids: | + RUBYGEMS_API_KEY,github-actions/hellosign/dropbox-sign-ruby/rubygems-api-key + parse-json-secrets: false + - name: Release Gem run: ./bin/ruby ./bin/release env: - RUBYGEMS_API_KEY: ${{ secrets.RUBYGEMS_API_KEY }} + RUBYGEMS_API_KEY: ${{ env.RUBYGEMS_API_KEY }} # This job runs on merging to "main" branch # Creates a new tag using the value in the VERSION file