Repository navigation
Fetch ci secrets from aws sm #71
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # This workflow will build the project, run integration tests, and release. | |
| # 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 | |
| on: | |
| push: | |
| branches: [ main ] | |
| pull_request: | |
| branches: [ main ] | |
| 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 | |
| - name: Ensure no changes in Generated Code | |
| run: ./bin/check-clean-git-status | |
| # This job runs on merging to "main" branch | |
| # 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' | |
| && 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 package with trusted publishing | |
| uses: pypa/gh-action-pypi-publish@release/v1 | |
| # This job runs on merging to "main" branch | |
| # Creates a new tag using the value in the VERSION file | |
| cut-tag: | |
| runs-on: ubuntu-latest | |
| if: >- | |
| github.repository == 'hellosign/dropbox-sign-python' | |
| && github.ref == 'refs/heads/main' | |
| && github.event_name != 'pull_request' | |
| needs: [ publish-prod ] | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Retrieve version | |
| run: echo "PACKAGE_VERSION=$(cat VERSION)" >> $GITHUB_ENV | |
| - name: Create tag | |
| uses: actions/github-script@v6 | |
| env: | |
| PACKAGE_VERSION: ${{ env.PACKAGE_VERSION }} | |
| with: | |
| script: | | |
| github.rest.git.createRef({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| ref: "refs/tags/" + process.env.PACKAGE_VERSION, | |
| sha: context.sha | |
| }) |