|
| 1 | +name: Serverless Branch Deployments |
| 2 | +on: |
| 3 | + pull_request: |
| 4 | + types: [opened, synchronize, reopened, closed] |
| 5 | + |
| 6 | +concurrency: |
| 7 | + # Cancel in-progress deploys to same branch |
| 8 | + group: ${{ github.ref }}/branch_deployments |
| 9 | + cancel-in-progress: true |
| 10 | +env: |
| 11 | + DAGSTER_CLOUD_URL: "http://ljw.dagster.cloud" |
| 12 | + DAGSTER_CLOUD_API_TOKEN: ${{ secrets.DAGSTER_CLOUD_API_TOKEN }} |
| 13 | + ENABLE_FAST_DEPLOYS: 'true' |
| 14 | + PYTHON_VERSION: '3.10' |
| 15 | + DAGSTER_CLOUD_FILE: 'dagster_cloud.yaml' |
| 16 | + |
| 17 | +jobs: |
| 18 | + dagster_cloud_default_deploy: |
| 19 | + name: Dagster Serverless Deploy |
| 20 | + runs-on: ubuntu-22.04 |
| 21 | + outputs: |
| 22 | + build_info: ${{ steps.parse-workspace.outputs.build_info }} |
| 23 | + |
| 24 | + steps: |
| 25 | + - name: Prerun Checks |
| 26 | + id: prerun |
| 27 | + uses: dagster-io/dagster-cloud-action/actions/utils/prerun@v0.1 |
| 28 | + |
| 29 | + - name: Launch Docker Deploy |
| 30 | + if: steps.prerun.outputs.result == 'docker-deploy' |
| 31 | + id: parse-workspace |
| 32 | + uses: dagster-io/dagster-cloud-action/actions/utils/parse_workspace@v0.1 |
| 33 | + with: |
| 34 | + dagster_cloud_file: $DAGSTER_CLOUD_FILE |
| 35 | + |
| 36 | + - name: Checkout for Python Executable Deploy |
| 37 | + if: steps.prerun.outputs.result == 'pex-deploy' |
| 38 | + uses: actions/checkout@v3 |
| 39 | + with: |
| 40 | + ref: ${{ github.head_ref }} |
| 41 | + path: project-repo |
| 42 | + |
| 43 | + - name: Python Executable Deploy |
| 44 | + if: steps.prerun.outputs.result == 'pex-deploy' |
| 45 | + uses: dagster-io/dagster-cloud-action/actions/build_deploy_python_executable@v0.1 |
| 46 | + with: |
| 47 | + dagster_cloud_file: "$GITHUB_WORKSPACE/project-repo/$DAGSTER_CLOUD_FILE" |
| 48 | + build_output_dir: "$GITHUB_WORKSPACE/build" |
| 49 | + python_version: "${{ env.PYTHON_VERSION }}" |
| 50 | + env: |
| 51 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 52 | + |
| 53 | + dagster_cloud_docker_deploy: |
| 54 | + name: Docker Deploy |
| 55 | + runs-on: ubuntu-20.04 |
| 56 | + if: needs.dagster_cloud_default_deploy.outputs.build_info |
| 57 | + needs: dagster_cloud_default_deploy |
| 58 | + strategy: |
| 59 | + fail-fast: false |
| 60 | + matrix: |
| 61 | + location: ${{ fromJSON(needs.dagster_cloud_default_deploy.outputs.build_info) }} |
| 62 | + steps: |
| 63 | + - name: Checkout |
| 64 | + uses: actions/checkout@v3 |
| 65 | + with: |
| 66 | + ref: ${{ github.head_ref }} |
| 67 | + - name: Build and deploy to Dagster Cloud serverless |
| 68 | + uses: dagster-io/dagster-cloud-action/actions/serverless_branch_deploy@v0.1 |
| 69 | + with: |
| 70 | + dagster_cloud_api_token: ${{ secrets.DAGSTER_CLOUD_API_TOKEN }} |
| 71 | + location: ${{ toJson(matrix.location) }} |
| 72 | + base_image: "python:${{ env.PYTHON_VERSION }}-slim" |
| 73 | + # Uncomment to pass through Github Action secrets as a JSON string of key-value pairs |
| 74 | + # env_vars: ${{ toJson(secrets) }} |
| 75 | + organization_id: ${{ secrets.ORGANIZATION_ID }} |
| 76 | + env: |
| 77 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
0 commit comments