2222 skip_bot_events :
2323 description : " manifest.skipBotEvents value for generated manifest."
2424 required : false
25- default : " true "
25+ default : " false "
2626 exclude_supported_events :
2727 description : " Comma-separated supported events to exclude from manifest listeners."
2828 required : false
3535 delete :
3636
3737jobs :
38- deploy :
39- name : " Deploy (Action / Deno) "
38+ resolve-context :
39+ name : " Resolve Context "
4040 runs-on : ubuntu-latest
41- permissions : write-all
42- environment : ${{ (github.event.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || github.event.workflow_run.head_branch == 'main') && 'main' || 'development' }}
41+ permissions : read-all
4342 env :
4443 BUILD_ACTION_ENABLED : ${{ github.event_name == 'workflow_dispatch' && inputs.build_action_enabled || vars.BUILD_ACTION_ENABLED || 'true' }}
4544 DEPLOY_DENO_ENABLED : ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_deno_enabled || vars.DEPLOY_DENO_ENABLED || 'true' }}
4645 SKIP_BOT_EVENTS : ${{ github.event_name == 'workflow_dispatch' && inputs.skip_bot_events || vars.SKIP_BOT_EVENTS || 'true' }}
47- EXCLUDE_SUPPORTED_EVENTS : ${{ github.event_name == 'workflow_dispatch' && inputs.exclude_supported_events || vars.EXCLUDE_SUPPORTED_EVENTS || 'issue_comment.created,pull_request_review_comment.created' }}
46+ EXCLUDE_SUPPORTED_EVENTS : ${{ github.event_name == 'workflow_dispatch' && inputs.exclude_supported_events || vars.EXCLUDE_SUPPORTED_EVENTS || 'issue_comment.created' }}
47+ outputs :
48+ source_ref : ${{ steps.refs.outputs.source_ref }}
49+ is_tag_ref : ${{ steps.refs.outputs.is_tag_ref }}
50+ is_dist_ref : ${{ steps.refs.outputs.is_dist_ref }}
51+ build_action_enabled : ${{ steps.config.outputs.build_action_enabled }}
52+ deploy_deno_enabled : ${{ steps.config.outputs.deploy_deno_enabled }}
53+ skip_bot_events : ${{ steps.config.outputs.skip_bot_events }}
54+ exclude_supported_events : ${{ steps.config.outputs.exclude_supported_events }}
55+ should_publish_action_artifact : ${{ steps.config.outputs.should_publish_action_artifact }}
56+ should_run_deno : ${{ steps.config.outputs.should_run_deno }}
57+ artifact_environment : ${{ steps.config.outputs.artifact_environment }}
58+ deno_environment : ${{ steps.config.outputs.deno_environment }}
59+ artifact_action : ${{ steps.config.outputs.artifact_action }}
60+ deno_action : ${{ steps.config.outputs.deno_action }}
4861
4962 steps :
5063 - name : Resolve source ref
@@ -61,93 +74,107 @@ jobs:
6174 is_tag_ref="true"
6275 fi
6376
64- is_artifact_ref ="false"
77+ is_dist_ref ="false"
6578 if [[ "$source_ref" == dist/* ]]; then
66- is_artifact_ref="true"
67- fi
68-
69- if [[ "$BUILD_ACTION_ENABLED" == "true" ]]; then
70- action_ref_branch="dist/${source_ref}"
71- else
72- action_ref_branch="${source_ref}"
79+ is_dist_ref="true"
7380 fi
7481
7582 echo "source_ref=$source_ref" >> "$GITHUB_OUTPUT"
7683 echo "is_tag_ref=$is_tag_ref" >> "$GITHUB_OUTPUT"
77- echo "is_artifact_ref=$is_artifact_ref" >> "$GITHUB_OUTPUT"
78- echo "ACTION_REF=${GITHUB_REPOSITORY}@${action_ref_branch}" >> "$GITHUB_ENV"
84+ echo "is_dist_ref=$is_dist_ref" >> "$GITHUB_OUTPUT"
7985
80- - name : Print deployment mode
86+ - name : Resolve deployment settings
87+ id : config
8188 shell : bash
89+ env :
90+ SOURCE_REF : ${{ steps.refs.outputs.source_ref }}
91+ IS_TAG_REF : ${{ steps.refs.outputs.is_tag_ref }}
92+ IS_DIST_REF : ${{ steps.refs.outputs.is_dist_ref }}
8293 run : |
83- echo "BUILD_ACTION_ENABLED=${BUILD_ACTION_ENABLED}"
84- echo "DEPLOY_DENO_ENABLED=${DEPLOY_DENO_ENABLED}"
85- echo "SKIP_BOT_EVENTS=${SKIP_BOT_EVENTS}"
86- echo "EXCLUDE_SUPPORTED_EVENTS=${EXCLUDE_SUPPORTED_EVENTS}"
87- echo "SOURCE_REF=${{ steps.refs.outputs.source_ref }}"
88- echo "IS_ARTIFACT_REF=${{ steps.refs.outputs.is_artifact_ref }}"
89- echo "IS_TAG_REF=${{ steps.refs.outputs.is_tag_ref }}"
90- echo "ACTION_REF=${ACTION_REF}"
94+ artifact_environment="development"
95+ if [[ "$SOURCE_REF" == "main" || "$SOURCE_REF" == "demo" ]]; then
96+ artifact_environment="main"
97+ fi
98+
99+ deno_environment="development"
100+ if [[ "$SOURCE_REF" == "main" ]]; then
101+ deno_environment="main"
102+ fi
103+
104+ artifact_action="publish"
105+ deno_action="provision"
106+ if [[ "${{ github.event_name }}" == "delete" ]]; then
107+ artifact_action="delete"
108+ deno_action="delete"
109+ fi
110+
111+ should_publish_action_artifact="false"
112+ if [[ "$BUILD_ACTION_ENABLED" == "true" && "$IS_TAG_REF" != "true" && "$IS_DIST_REF" != "true" ]]; then
113+ should_publish_action_artifact="true"
114+ fi
115+
116+ should_run_deno="false"
117+ if [[ "$DEPLOY_DENO_ENABLED" == "true" && "$IS_TAG_REF" != "true" && "$IS_DIST_REF" != "true" ]]; then
118+ should_run_deno="true"
119+ fi
91120
121+ echo "build_action_enabled=$BUILD_ACTION_ENABLED" >> "$GITHUB_OUTPUT"
122+ echo "deploy_deno_enabled=$DEPLOY_DENO_ENABLED" >> "$GITHUB_OUTPUT"
123+ echo "skip_bot_events=$SKIP_BOT_EVENTS" >> "$GITHUB_OUTPUT"
124+ echo "exclude_supported_events=$EXCLUDE_SUPPORTED_EVENTS" >> "$GITHUB_OUTPUT"
125+ echo "artifact_environment=$artifact_environment" >> "$GITHUB_OUTPUT"
126+ echo "deno_environment=$deno_environment" >> "$GITHUB_OUTPUT"
127+ echo "artifact_action=$artifact_action" >> "$GITHUB_OUTPUT"
128+ echo "deno_action=$deno_action" >> "$GITHUB_OUTPUT"
129+ echo "should_publish_action_artifact=$should_publish_action_artifact" >> "$GITHUB_OUTPUT"
130+ echo "should_run_deno=$should_run_deno" >> "$GITHUB_OUTPUT"
131+
132+ publish-action-artifact :
133+ name : " Publish Action Artifact"
134+ needs : resolve-context
135+ if : ${{ needs.resolve-context.outputs.should_publish_action_artifact == 'true' }}
136+ runs-on : ubuntu-latest
137+ permissions : write-all
138+ environment : ${{ needs.resolve-context.outputs.artifact_environment }}
139+
140+ steps :
92141 - name : Publish action artifact branch
93- if : ${{ env.BUILD_ACTION_ENABLED == 'true' }}
94142 uses : ubiquity-os/action-deploy-plugin@main
95143 with :
96- action : ${{ github.event_name == 'delete' && 'delete' || 'publish' }}
144+ action : ${{ needs.resolve-context.outputs.artifact_action }}
97145 treatAsEsm : true
98146 sourcemap : true
99- pluginEntry : " ${{ github.workspace }}/src/action .ts"
100- excludeSupportedEvents : ${{ env.EXCLUDE_SUPPORTED_EVENTS }}
101- skipBotEvents : ${{ env.SKIP_BOT_EVENTS }}
147+ pluginEntry : " ${{ github.workspace }}/src/worker .ts"
148+ excludeSupportedEvents : ${{ needs.resolve-context.outputs.exclude_supported_events }}
149+ skipBotEvents : ${{ needs.resolve-context.outputs.skip_bot_events }}
102150 env :
103151 APP_ID : ${{ secrets.APP_ID }}
104152 APP_PRIVATE_KEY : ${{ secrets.APP_PRIVATE_KEY }}
105153
106- - name : Check out the repository
107- if : ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' }}
108- uses : actions/checkout@v6
109-
110- - name : Set up Deno
111- if : ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' }}
112- uses : denoland/setup-deno@v2
113- with :
114- deno-version : v2.x
115-
116- - name : Install dependencies
117- if : ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' && github.event_name != 'delete' }}
118- run : deno install --node-modules-dir=auto --no-lock
119-
120- - name : Generate manifest for deploy
121- if : ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' && github.event_name != 'delete' }}
122- run : deno x -A -y --no-lock npm:@ubiquity-os/plugin-manifest-tool@latest
123- env :
124- SKIP_BOT_EVENTS : ${{ env.SKIP_BOT_EVENTS }}
125- EXCLUDE_SUPPORTED_EVENTS : ${{ env.EXCLUDE_SUPPORTED_EVENTS }}
126- GITHUB_REF_NAME : ${{ steps.refs.outputs.source_ref }}
154+ deploy-deno :
155+ name : " Provision Deno App"
156+ needs : resolve-context
157+ if : ${{ needs.resolve-context.outputs.should_run_deno == 'true' }}
158+ runs-on : ubuntu-latest
159+ permissions : write-all
160+ environment : ${{ needs.resolve-context.outputs.deno_environment }}
127161
128- - uses : ubiquity-os/deno-plugin-adapter@main
129- if : ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' && github.event_name != 'delete' }}
130- id : adapter
131- with :
132- pluginEntry : " ./worker"
162+ steps :
163+ - uses : actions/checkout@v6
164+ if : ${{ needs.resolve-context.outputs.deno_action != 'delete' }}
133165
134- - uses : ubiquity-os/deno-deploy@main
135- if : ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' }}
166+ - uses : ubiquity-os/deno-deploy@issue-17-deno-deploy-app-migration
136167 env :
137168 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
138169 KERNEL_PUBLIC_KEY : ${{ secrets.KERNEL_PUBLIC_KEY }}
139170 APP_ID : ${{ secrets.APP_ID }}
140171 APP_PRIVATE_KEY : ${{ secrets.APP_PRIVATE_KEY }}
141172 APP_INSTALLATION_ID : ${{ secrets.APP_INSTALLATION_ID }}
142- ACTION_REF : ${{ env.ACTION_REF }}
143173 LOG_LEVEL : ${{ secrets.LOG_LEVEL }}
144174 SUPABASE_URL : ${{ secrets.SUPABASE_URL }}
145175 SUPABASE_KEY : ${{ secrets.SUPABASE_KEY }}
146176 with :
147177 token : ${{ secrets.DENO_DEPLOY_TOKEN }}
148- action : ${{ github.event_name == 'delete' && 'delete' || 'deploy' }}
149- organization : ${{ secrets.DENO_ORG_NAME }}
150- entrypoint : ${{ github.event_name == 'delete' && 'src/deno.ts' || steps.adapter.outputs.entrypoint }}
151- project_name : ${{ secrets.DENO_PROJECT_NAME }}
152- sourceRef : ${{ steps.refs.outputs.source_ref }}
153- artifactPrefix : dist/
178+ action : ${{ needs.resolve-context.outputs.deno_action }}
179+ app : ${{ secrets.DENO_PROJECT_NAME }}
180+ entrypoint : src/worker.ts
0 commit comments