feat: OIDC provider #63
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
| name: Preview | |
| on: | |
| pull_request: | |
| types: [opened, synchronize, reopened, closed] | |
| concurrency: | |
| group: preview-${{ github.event.pull_request.number }} | |
| cancel-in-progress: true | |
| jobs: | |
| deploy: | |
| name: Deploy & Test | |
| needs: deploy-public-log-stream | |
| if: github.event.action != 'closed' | |
| uses: ./.github/workflows/deploy.yml | |
| with: | |
| worker_name: source-data-proxy-pr-${{ github.event.pull_request.number }} | |
| wrangler_config: wrangler.preview.toml | |
| var_overrides: >- | |
| LOG_LEVEL:DEBUG | |
| SOURCE_API_URL:https://staging.source.coop | |
| OIDC_PROVIDER_ISSUER:https://source-data-proxy-pr-${{ github.event.pull_request.number }}.source-coop.workers.dev | |
| OIDC_PROVIDER_KID:source-proxy-1 | |
| AUTH_ISSUER:https://auth.staging.source.coop | |
| service_overrides: >- | |
| PUBLIC_LOG_STREAM:public-log-stream-pr-${{ github.event.pull_request.number }} | |
| environment: preview | |
| secrets: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| OIDC_PROVIDER_KEY: ${{ secrets.OIDC_PROVIDER_KEY }} | |
| SESSION_TOKEN_KEY: ${{ secrets.SESSION_TOKEN_KEY }} | |
| deploy-public-log-stream: | |
| name: Deploy Public Log Stream | |
| if: github.event.action != 'closed' | |
| uses: ./.github/workflows/deploy-public-log-stream.yml | |
| with: | |
| worker_name: public-log-stream-pr-${{ github.event.pull_request.number }} | |
| wrangler_config: wrangler.preview.toml | |
| environment: preview | |
| secrets: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| comment: | |
| name: PR Comment | |
| needs: deploy | |
| if: github.event.action != 'closed' | |
| runs-on: ubuntu-latest | |
| permissions: | |
| pull-requests: write | |
| steps: | |
| - name: Find Comment | |
| uses: peter-evans/find-comment@v4 | |
| id: find-comment | |
| with: | |
| issue-number: ${{ github.event.pull_request.number }} | |
| comment-author: "github-actions[bot]" | |
| body-includes: Latest commit deployed to | |
| - name: Create or update comment | |
| uses: peter-evans/create-or-update-comment@v5 | |
| with: | |
| comment-id: ${{ steps.find-comment.outputs.comment-id }} | |
| issue-number: ${{ github.event.pull_request.number }} | |
| body: | | |
| 🚀 Latest commit deployed to ${{ needs.deploy.outputs.deploy_url }} | |
| * Date: `${{ github.event.pull_request.updated_at }}` | |
| * Commit: ${{ github.sha }} | |
| edit-mode: replace | |
| cleanup: | |
| name: Cleanup Preview | |
| if: github.event.action == 'closed' | |
| runs-on: ubuntu-latest | |
| env: | |
| CLOUDFLARE_API_TOKEN: ${{ secrets.CLOUDFLARE_API_TOKEN }} | |
| CLOUDFLARE_ACCOUNT_ID: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }} | |
| steps: | |
| - name: Delete preview worker | |
| run: npx wrangler@3 delete --name "source-data-proxy-pr-${{ github.event.pull_request.number }}" --force | |
| - name: Delete preview public-log-stream worker | |
| run: npx wrangler@3 delete --name "public-log-stream-pr-${{ github.event.pull_request.number }}" --force |