Merge pull request #3549 from cal-itp/3519-update-monthly-ntd #104
This file contains 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: 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/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GCP_SA_KEY }}' | |
- uses: google-github-actions/setup-gcloud@v2 | |
# Only update requirements if they have changed; Composer throws an error if there are no changes to apply | |
- uses: tj-actions/changed-files@v41 | |
if: ${{ github.ref == 'refs/heads/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-composer2-patch --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-88ca8ec6-bucket" |