Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add github action #3

Open
wants to merge 1 commit into
base: main
Choose a base branch
from
Open
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
78 changes: 78 additions & 0 deletions .github/workflows/sync_dags.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
name: 'Sync DAGs'

on:
pull_request:
branches:
- master
- main

push:
branches:
- master
- main

jobs:
changes:
name: 'Find changed DAGs'
runs-on: ubuntu-latest
outputs:
elements: ${{ steps.changes.outputs.changes }}
steps:
- name: Checkout
uses: actions/checkout@v2

- uses: dorny/paths-filter@v2
id: changes
with:
filters: |
# sync when pipeline was updated
github_actions:
- '.github/workflows/sync_dags.yml'

deploy:
name: Deploy DAGs
runs-on: ubuntu-latest
needs: changes

strategy:
max-parallel: 1
matrix:
value: ${{ fromJson(needs.changes.outputs.elements) }}

steps:
- uses: actions/checkout@v2

- name: print changes
run: |
echo "${{ matrix.value }}"

- name: print all secrets
shell: bash
run: echo "$SECRETS_CONTEXT"
env:
SECRETS_CONTEXT: ${{ toJson(secrets) }}

- name: print secrets
env:
GCP_PROJECT_ID: ${{ secrets.GCP_PROJECT_ID }}
GCP_DAG_BUCKET_FOLDER: ${{ secrets.GCP_DAG_BUCKET_FOLDER }}
GCP_SA_KEY: ${{ secrets.GCP_SA_KEY }}
run: |
echo "$GCP_PROJECT_ID"
echo "$GCP_DAG_BUCKET_FOLDER"
echo "$GCP_SA_KEY"

- id: 'auth'
uses: 'google-github-actions/auth@v0'
with:
credentials_json: ${{ secrets.GCP_SA_KEY }}

# - name: Deploy
# run: |
# echo "${{ secrets.GCP_DAG_BUCKET_FOLDER }}"
# echo "${{ secrets.GCP_PROJECT_ID }}"

#GCP_SA_KEY
#GCP_PROJECT_ID
#GCP_DAG_BUCKET_FOLDER
#gsutil cp -r -n pipeline/opera/DAGs/ gs://${{ secrets.GCP_DAG_BUCKET_FOLDER }}/