-
Notifications
You must be signed in to change notification settings - Fork 15
39 lines (34 loc) · 1.28 KB
/
deploy-airflow.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
name: Deploy Airflow DAGs
on:
push:
branches:
- main
paths:
- 'airflow/**'
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Check out repo
uses: actions/checkout@v2
with:
fetch-depth: 0
- uses: google-github-actions/setup-gcloud@v0
with:
export_default_credentials: true
service_account_key: ${{ secrets.GCP_SA_KEY }}
# Only update requirements if they have changed; Composer throws an error if there are no changes to apply
- uses: tj-actions/changed-files@v35
if: github.event.pull_request.base.ref == 'main'
id: changed-requirements
with:
files: 'airflow/requirements.txt'
- id: install-python-dependencies
if: steps.changed-requirements.outputs.any_changed == 'true'
run: gcloud composer environments update calitp-airflow2-prod --update-pypi-packages-from-file airflow/requirements.txt --location us-west2 --project cal-itp-data-infra
- name: Push Airflow code to GCS
run: |
gsutil -m rsync -d -c -r airflow/dags gs://$AIRFLOW_BUCKET/dags
gsutil -m rsync -d -c -r airflow/plugins gs://$AIRFLOW_BUCKET/plugins
env:
AIRFLOW_BUCKET: "us-west2-calitp-airflow2-pr-171e4e47-bucket"