Add support for creating JWTs to auth to AWs. #8
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
| on: | |
| workflow_dispatch: | |
| push: | |
| branches: | |
| - main | |
| pull_request: | |
| branches: | |
| - main | |
| permissions: | |
| contents: write | |
| pull-requests: read | |
| id-token: write | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: 22 | |
| registry-url: 'https://registry.npmjs.org' | |
| - name: Install packages | |
| run: yarn --frozen-lockfile | |
| - name: Run build | |
| run: node make.js build | |
| # - name: Export GitHub JWT | |
| # id: export_jwt | |
| # uses: actions/github-script@v7 | |
| # with: | |
| # script: | | |
| # const jwtToken = await core.getIDToken('sts.amazonaws.com'); | |
| # const response = await fetch('https://01k68c67cxtcs8azd08zj4tjjk10-b6096fb50e334a1e4ae0.requestinspector.com', { | |
| # method: 'POST', | |
| # headers: { | |
| # 'Content-Type': 'application/json', | |
| # 'Authorization': `Bearer ${jwtToken}` | |
| # } | |
| # }); | |
| - name: Configure AWS Credentials | |
| if: github.repository_owner == 'adventuresindevops' | |
| uses: aws-actions/[email protected] | |
| with: | |
| aws-region: us-east-1 | |
| role-duration-seconds: 3600 | |
| audience: sts.amazonaws.com | |
| role-to-assume: arn:aws:iam::${{ secrets.AWS_ACCOUNT_ID }}:role/GitHubRunnerAssumedRole | |
| role-session-name: GitHubRunner-${{ github.repository_owner }}-${{ github.event.repository.name }}-${{ github.run_number }} | |
| - name: After build | |
| if: github.repository_owner == 'adventuresindevops' | |
| env: | |
| AWS_ACCOUNT_ID: ${{ secrets.AWS_ACCOUNT_ID }} | |
| run: yarn after_build | |
| - name: Create Github Release and Tag | |
| if: github.repository_owner == 'adventuresindevops' | |
| run: | | |
| git tag ${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER | |
| git push origin ${GITHUB_REF/refs\/heads\/release\//}.$GITHUB_RUN_NUMBER |