|
| 1 | +name: deploy_tda.yml |
| 2 | +run-name: triggered by ${{ github.actor }} |
| 3 | + |
| 4 | +on: |
| 5 | + push: |
| 6 | + workflow_dispatch: |
| 7 | + |
| 8 | +# Only run 1 workflow at a time. If new one starts abort any that are already running. |
| 9 | +concurrency: |
| 10 | + group: ${{ github.workflow }} |
| 11 | + cancel-in-progress: true |
| 12 | + |
| 13 | +jobs: |
| 14 | + default-job: |
| 15 | + if: github.repository_owner == 'sentry-demos' # don't run in forks |
| 16 | + permissions: |
| 17 | + contents: 'read' |
| 18 | + id-token: 'write' |
| 19 | + runs-on: ubuntu-22.04 |
| 20 | + |
| 21 | + steps: |
| 22 | + - run: echo "Triggered by ${{ github.event_name }} event." |
| 23 | + - run: echo "Branch is ${{ github.ref }}" |
| 24 | + |
| 25 | + - name: Check out this repository code |
| 26 | + uses: actions/checkout@v3 |
| 27 | + with: |
| 28 | + path: empower |
| 29 | + fetch-depth: 0 |
| 30 | + |
| 31 | + - name: Check out `empower-config` to get GCP identity provider and account name |
| 32 | + uses: actions/checkout@v3 |
| 33 | + with: |
| 34 | + repository: sentry-demos/empower-config |
| 35 | + path: empower-config |
| 36 | + token: ${{ secrets.KOSTY_PERSONAL_ACCESS_TOKEN_FOR_SYNC_DEPLOY_FORK }} |
| 37 | + |
| 38 | + - name: Get GCP_ env variables from empower-config/.gcloudrc |
| 39 | + run: | |
| 40 | + source empower-config/.gcloudrc |
| 41 | + echo "GCP_WORKLOAD_IDENTITY_PROVIDER=$GCP_WORKLOAD_IDENTITY_PROVIDER" >> $GITHUB_OUTPUT |
| 42 | + echo "GCP_SERVICE_ACCOUNT=$GCP_SERVICE_ACCOUNT" >> $GITHUB_OUTPUT |
| 43 | + id: gcloudrc |
| 44 | + |
| 45 | + - id: 'auth' |
| 46 | + name: 'Authenticate Google Cloud' |
| 47 | + uses: 'google-github-actions/auth@v2' |
| 48 | + with: |
| 49 | + workload_identity_provider: ${{ steps.gcloudrc.outputs.GCP_WORKLOAD_IDENTITY_PROVIDER }} |
| 50 | + service_account: ${{ steps.gcloudrc.outputs.GCP_SERVICE_ACCOUNT }} |
| 51 | + |
| 52 | + - name: 'Set up Google Cloud SDK' |
| 53 | + uses: 'google-github-actions/setup-gcloud@v2' |
| 54 | + |
| 55 | + - name: Run deploy_tda.sh |
| 56 | + run: gcloud compute config-ssh && ./deploy_tda.sh |
| 57 | + working-directory: ./empower/tda |
| 58 | + |
| 59 | + - run: echo "Job status is ${{ job.status }}." |
| 60 | + |
0 commit comments