Skip to content

Commit 42f2439

Browse files
committed
Add Dagster Cloud deploy actions
1 parent c44585d commit 42f2439

File tree

2 files changed

+156
-0
lines changed

2 files changed

+156
-0
lines changed
+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
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 }}

.github/workflows/deploy.yml

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

0 commit comments

Comments
 (0)