-
Notifications
You must be signed in to change notification settings - Fork 188
53 lines (47 loc) · 1.87 KB
/
preview-env-teardown.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
name: preview-env-teardown
on:
pull_request:
jobs:
deploy-preview:
#if: github.event.label.name == 'deploy' || (github.event.action == 'closed' && contains( github.event.pull_request.labels.*.name, 'deploy') )
runs-on: ubuntu-22.04
timeout-minutes: 20
name: teardown-preview-env
steps:
- uses: actions/checkout@v2
- name: Import secrets
id: secrets
uses: hashicorp/vault-action@d1720f055e0635fd932a1d2a48f87a666a57906c
with:
url: ${{ secrets.VAULT_ADDR }}
method: approle
roleId: ${{ secrets.VAULT_ROLE_ID }}
secretId: ${{ secrets.VAULT_SECRET_ID }}
secrets: |
secret/data/products/camunda-docs/ci/preview-environment PREVIEW_ENV_BUCKET_NAME;
secret/data/products/camunda-docs/ci/preview-environment PREVIEW_ENV_GCLOUD_SA_KEY;
secret/data/products/camunda-docs/ci/preview-environment TEMP_BUCKET;
secret/data/products/camunda-docs/ci/preview-environment TEMP_SA;
- name: Authenticate with Google Cloud
uses: google-github-actions/auth@v2
with:
credentials_json: ${{ steps.secrets.outputs.TEMP_SA }}
- name: Set up Cloud SDK
uses: google-github-actions/setup-gcloud@v2
with:
version: ">= 363.0.0"
- name: Remove files from Google bucket
env:
BUCKET_NAME: ${{ steps.secrets.outputs.TEMP_BUCKET }}
run: |
gcloud config set pass_credentials_to_gsutil true
gsutil -m rm -r gs://$BUCKET_NAME/pr-${{ github.event.number }}
- name: Update comment
uses: peter-evans/create-or-update-comment@v4
env:
BUCKET_NAME: ${{ steps.secrets.outputs.TEMP_BUCKET }}
with:
issue-number: ${{ github.event.number }}
body: |
Your preview env has been teared down.
edit-mode: replace