Skip to content

Merge release into main branch #845

Merge release into main branch

Merge release into main branch #845

Workflow file for this run

name: Bigquery dedicated env
on:
pull_request:
types: [closed, unlabeled, labeled, synchronize]
env:
NODE_VERSION: 14
jobs:
dedicated:
if: |
github.event.label.name == 'dedicated_bigquery' ||
(github.event.action == 'closed' && contains(github.event.pull_request.labels.*.name, 'dedicated_bigquery')) ||
(github.event.action == 'synchronize' && contains(github.event.pull_request.labels.*.name, 'dedicated_bigquery'))
runs-on: ubuntu-20.04
timeout-minutes: 20
env:
GCLOUD_VERSION: 290.0.1
BQ_PROJECT: ${{ secrets.BQ_PROJECT_CD }}
BQ_REGION: ${{ secrets.BQ_REGION_CD }}
BQ_BUCKET: ${{ secrets.BQ_BUCKET_CD }}
steps:
- name: Checkout repo
uses: actions/checkout@v2
- name: Set BQ_PREFIX for releases
if: startsWith(github.event.pull_request.head.ref, 'release/')
run: |
echo "BQ_PREFIX=dedicated_release_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Set BQ_PREFIX for hotfixes
if: startsWith(github.event.pull_request.head.ref, 'hotfix/')
run: |
echo "BQ_PREFIX=dedicated_hotfix_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Set BQ_PREFIX for regular deploys
if: |
!(startsWith(github.event.pull_request.head.ref, 'hotfix/')) &&
!(startsWith(github.event.pull_request.head.ref, 'release/'))
run: echo "BQ_PREFIX=dedicated_${{ github.event.pull_request.number }}_" >> $GITHUB_ENV
- name: Setup node
uses: actions/setup-node@v1
with:
node-version: ${{ env.NODE_VERSION }}
- name: Auth google
uses: google-github-actions/auth@v0
with:
credentials_json: ${{ secrets.BQCARTOCD_DEPLOY_CLOUD_EXTENSIONS_SA_BASE64 }}
project_id: ${{ env.BQ_PROJECT }}
create_credentials_file: true
- name: Setup gcloud
uses: google-github-actions/setup-gcloud@v0
with:
version: ${{ env.GCLOUD_VERSION }}
project_id: ${{ env.BQ_PROJECT }}
- name: Run deploy
id: deploy
if: github.event.action == 'synchronize' || github.event.action == 'labeled'
run: |
cd clouds/bigquery
make deploy
- name: Run remove
id: remove
if: github.event.action == 'unlabeled' || github.event.action == 'closed'
run: |
cd clouds/bigquery
make remove
- name: Comment deploy PR
if: steps.deploy.outcome == 'success' && github.event.action == 'labeled'
uses: thollander/actions-comment-pull-request@v1
with:
message: |
Dedicated ${{ env.BQ_PREFIX }}carto environment deployed in Bigquery project ${{ env.BQ_PROJECT }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Comment remove PR
if: steps.remove.outcome == 'success' && (github.event.action == 'unlabeled' || github.event.action == 'closed')
uses: thollander/actions-comment-pull-request@v1
with:
message: |
Dedicated environment removed
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}