-
Notifications
You must be signed in to change notification settings - Fork 30
ci: migrate deploy workflow to new deno-deploy flow #65
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
Changes from all commits
8747610
6fa3cb8
7aa4852
94d793c
5e03fa7
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||||||||||
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
|
|
@@ -22,7 +22,7 @@ on: | |||||||||||||
| skip_bot_events: | ||||||||||||||
| description: "manifest.skipBotEvents value for generated manifest." | ||||||||||||||
| required: false | ||||||||||||||
| default: "true" | ||||||||||||||
| default: "false" | ||||||||||||||
| exclude_supported_events: | ||||||||||||||
| description: "Comma-separated supported events to exclude from manifest listeners." | ||||||||||||||
| required: false | ||||||||||||||
|
|
@@ -35,16 +35,29 @@ on: | |||||||||||||
| delete: | ||||||||||||||
|
|
||||||||||||||
| jobs: | ||||||||||||||
| deploy: | ||||||||||||||
| name: "Deploy (Action / Deno)" | ||||||||||||||
| resolve-context: | ||||||||||||||
| name: "Resolve Context" | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| permissions: write-all | ||||||||||||||
| environment: ${{ (github.event.ref == 'refs/heads/main' || github.ref == 'refs/heads/main' || github.event.workflow_run.head_branch == 'main') && 'main' || 'development' }} | ||||||||||||||
| permissions: read-all | ||||||||||||||
| env: | ||||||||||||||
| BUILD_ACTION_ENABLED: ${{ github.event_name == 'workflow_dispatch' && inputs.build_action_enabled || vars.BUILD_ACTION_ENABLED || 'true' }} | ||||||||||||||
| DEPLOY_DENO_ENABLED: ${{ github.event_name == 'workflow_dispatch' && inputs.deploy_deno_enabled || vars.DEPLOY_DENO_ENABLED || 'true' }} | ||||||||||||||
| SKIP_BOT_EVENTS: ${{ github.event_name == 'workflow_dispatch' && inputs.skip_bot_events || vars.SKIP_BOT_EVENTS || 'true' }} | ||||||||||||||
| SKIP_BOT_EVENTS: ${{ github.event_name == 'workflow_dispatch' && inputs.skip_bot_events || vars.SKIP_BOT_EVENTS || 'false' }} | ||||||||||||||
| EXCLUDE_SUPPORTED_EVENTS: ${{ github.event_name == 'workflow_dispatch' && inputs.exclude_supported_events || vars.EXCLUDE_SUPPORTED_EVENTS || 'issue_comment.created,pull_request_review_comment.created' }} | ||||||||||||||
| outputs: | ||||||||||||||
| source_ref: ${{ steps.refs.outputs.source_ref }} | ||||||||||||||
| is_tag_ref: ${{ steps.refs.outputs.is_tag_ref }} | ||||||||||||||
| is_dist_ref: ${{ steps.refs.outputs.is_dist_ref }} | ||||||||||||||
| build_action_enabled: ${{ steps.config.outputs.build_action_enabled }} | ||||||||||||||
| deploy_deno_enabled: ${{ steps.config.outputs.deploy_deno_enabled }} | ||||||||||||||
| skip_bot_events: ${{ steps.config.outputs.skip_bot_events }} | ||||||||||||||
| exclude_supported_events: ${{ steps.config.outputs.exclude_supported_events }} | ||||||||||||||
| should_publish_action_artifact: ${{ steps.config.outputs.should_publish_action_artifact }} | ||||||||||||||
| should_run_deno: ${{ steps.config.outputs.should_run_deno }} | ||||||||||||||
| artifact_environment: ${{ steps.config.outputs.artifact_environment }} | ||||||||||||||
| deno_environment: ${{ steps.config.outputs.deno_environment }} | ||||||||||||||
| artifact_action: ${{ steps.config.outputs.artifact_action }} | ||||||||||||||
| deno_action: ${{ steps.config.outputs.deno_action }} | ||||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| - name: Resolve source ref | ||||||||||||||
|
|
@@ -61,93 +74,104 @@ jobs: | |||||||||||||
| is_tag_ref="true" | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| is_artifact_ref="false" | ||||||||||||||
| is_dist_ref="false" | ||||||||||||||
| if [[ "$source_ref" == dist/* ]]; then | ||||||||||||||
| is_artifact_ref="true" | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| if [[ "$BUILD_ACTION_ENABLED" == "true" ]]; then | ||||||||||||||
| action_ref_branch="dist/${source_ref}" | ||||||||||||||
| else | ||||||||||||||
| action_ref_branch="${source_ref}" | ||||||||||||||
| is_dist_ref="true" | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| echo "source_ref=$source_ref" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "is_tag_ref=$is_tag_ref" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "is_artifact_ref=$is_artifact_ref" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "ACTION_REF=${GITHUB_REPOSITORY}@${action_ref_branch}" >> "$GITHUB_ENV" | ||||||||||||||
| echo "is_dist_ref=$is_dist_ref" >> "$GITHUB_OUTPUT" | ||||||||||||||
|
|
||||||||||||||
| - name: Print deployment mode | ||||||||||||||
| - name: Resolve deployment settings | ||||||||||||||
| id: config | ||||||||||||||
| shell: bash | ||||||||||||||
| env: | ||||||||||||||
| SOURCE_REF: ${{ steps.refs.outputs.source_ref }} | ||||||||||||||
| IS_TAG_REF: ${{ steps.refs.outputs.is_tag_ref }} | ||||||||||||||
| IS_DIST_REF: ${{ steps.refs.outputs.is_dist_ref }} | ||||||||||||||
| run: | | ||||||||||||||
| echo "BUILD_ACTION_ENABLED=${BUILD_ACTION_ENABLED}" | ||||||||||||||
| echo "DEPLOY_DENO_ENABLED=${DEPLOY_DENO_ENABLED}" | ||||||||||||||
| echo "SKIP_BOT_EVENTS=${SKIP_BOT_EVENTS}" | ||||||||||||||
| echo "EXCLUDE_SUPPORTED_EVENTS=${EXCLUDE_SUPPORTED_EVENTS}" | ||||||||||||||
| echo "SOURCE_REF=${{ steps.refs.outputs.source_ref }}" | ||||||||||||||
| echo "IS_ARTIFACT_REF=${{ steps.refs.outputs.is_artifact_ref }}" | ||||||||||||||
| echo "IS_TAG_REF=${{ steps.refs.outputs.is_tag_ref }}" | ||||||||||||||
| echo "ACTION_REF=${ACTION_REF}" | ||||||||||||||
| artifact_environment="development" | ||||||||||||||
| deno_environment="development" | ||||||||||||||
| if [[ "$SOURCE_REF" == "main" || "$SOURCE_REF" == "demo" ]]; then | ||||||||||||||
| artifact_environment="main" | ||||||||||||||
| deno_environment="main" | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| artifact_action="publish" | ||||||||||||||
| deno_action="provision" | ||||||||||||||
| if [[ "${{ github.event_name }}" == "delete" ]]; then | ||||||||||||||
| artifact_action="delete" | ||||||||||||||
| deno_action="delete" | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| should_publish_action_artifact="false" | ||||||||||||||
| if [[ "$BUILD_ACTION_ENABLED" == "true" && "$IS_TAG_REF" != "true" && "$IS_DIST_REF" != "true" ]]; then | ||||||||||||||
| should_publish_action_artifact="true" | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| should_run_deno="false" | ||||||||||||||
| if [[ "$DEPLOY_DENO_ENABLED" == "true" && "$IS_TAG_REF" != "true" && "$IS_DIST_REF" != "true" ]]; then | ||||||||||||||
| should_run_deno="true" | ||||||||||||||
| fi | ||||||||||||||
|
|
||||||||||||||
| echo "build_action_enabled=$BUILD_ACTION_ENABLED" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "deploy_deno_enabled=$DEPLOY_DENO_ENABLED" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "skip_bot_events=$SKIP_BOT_EVENTS" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "exclude_supported_events=$EXCLUDE_SUPPORTED_EVENTS" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "artifact_environment=$artifact_environment" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "deno_environment=$deno_environment" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "artifact_action=$artifact_action" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "deno_action=$deno_action" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "should_publish_action_artifact=$should_publish_action_artifact" >> "$GITHUB_OUTPUT" | ||||||||||||||
| echo "should_run_deno=$should_run_deno" >> "$GITHUB_OUTPUT" | ||||||||||||||
|
|
||||||||||||||
| publish-action-artifact: | ||||||||||||||
| name: "Publish Action Artifact" | ||||||||||||||
| needs: resolve-context | ||||||||||||||
| if: ${{ needs.resolve-context.outputs.should_publish_action_artifact == 'true' }} | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| permissions: write-all | ||||||||||||||
| environment: ${{ needs.resolve-context.outputs.artifact_environment }} | ||||||||||||||
|
|
||||||||||||||
| steps: | ||||||||||||||
| - name: Publish action artifact branch | ||||||||||||||
| if: ${{ env.BUILD_ACTION_ENABLED == 'true' }} | ||||||||||||||
| uses: ubiquity-os/action-deploy-plugin@main | ||||||||||||||
| with: | ||||||||||||||
| action: ${{ github.event_name == 'delete' && 'delete' || 'publish' }} | ||||||||||||||
| action: ${{ needs.resolve-context.outputs.artifact_action }} | ||||||||||||||
| treatAsEsm: true | ||||||||||||||
| sourcemap: true | ||||||||||||||
| pluginEntry: "${{ github.workspace }}/src/action.ts" | ||||||||||||||
| excludeSupportedEvents: ${{ env.EXCLUDE_SUPPORTED_EVENTS }} | ||||||||||||||
| skipBotEvents: ${{ env.SKIP_BOT_EVENTS }} | ||||||||||||||
| pluginEntry: "${{ github.workspace }}/src/worker.ts" | ||||||||||||||
| excludeSupportedEvents: ${{ needs.resolve-context.outputs.exclude_supported_events }} | ||||||||||||||
| skipBotEvents: ${{ needs.resolve-context.outputs.skip_bot_events }} | ||||||||||||||
|
Comment on lines
+144
to
+146
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🏁 Script executed: # Check the workflow file around lines 147-149
sed -n '140,155p' .github/workflows/update-configuration.ymlRepository: ubiquity-os/plugin-template Length of output: 711 🏁 Script executed: # Check what's exported from src/worker.ts
head -30 src/worker.tsRepository: ubiquity-os/plugin-template Length of output: 1239 🏁 Script executed: # Check what's exported from src/action.ts
head -30 src/action.tsRepository: ubiquity-os/plugin-template Length of output: 938 🏁 Script executed: # Get broader context of the artifact job in the workflow
sed -n '130,160p' .github/workflows/update-configuration.ymlRepository: ubiquity-os/plugin-template Length of output: 1311 Use the Actions entrypoint for the artifact build.
Suggested change- pluginEntry: "${{ github.workspace }}/src/worker.ts"
+ pluginEntry: "${{ github.workspace }}/src/action.ts"📝 Committable suggestion
Suggested change
|
||||||||||||||
| env: | ||||||||||||||
| APP_ID: ${{ secrets.APP_ID }} | ||||||||||||||
| APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} | ||||||||||||||
|
|
||||||||||||||
| - name: Check out the repository | ||||||||||||||
| if: ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' }} | ||||||||||||||
| uses: actions/checkout@v6 | ||||||||||||||
|
|
||||||||||||||
| - name: Set up Deno | ||||||||||||||
| if: ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' }} | ||||||||||||||
| uses: denoland/setup-deno@v2 | ||||||||||||||
| with: | ||||||||||||||
| deno-version: v2.x | ||||||||||||||
|
|
||||||||||||||
| - name: Install dependencies | ||||||||||||||
| if: ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' && github.event_name != 'delete' }} | ||||||||||||||
| run: deno install --node-modules-dir=auto --no-lock | ||||||||||||||
|
|
||||||||||||||
| - name: Generate manifest for deploy | ||||||||||||||
| if: ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' && github.event_name != 'delete' }} | ||||||||||||||
| run: deno x -A -y --no-lock npm:@ubiquity-os/plugin-manifest-tool@latest | ||||||||||||||
| env: | ||||||||||||||
| SKIP_BOT_EVENTS: ${{ env.SKIP_BOT_EVENTS }} | ||||||||||||||
| EXCLUDE_SUPPORTED_EVENTS: ${{ env.EXCLUDE_SUPPORTED_EVENTS }} | ||||||||||||||
| GITHUB_REF_NAME: ${{ steps.refs.outputs.source_ref }} | ||||||||||||||
| deploy-deno: | ||||||||||||||
| name: "Provision Deno App" | ||||||||||||||
| needs: resolve-context | ||||||||||||||
| if: ${{ needs.resolve-context.outputs.should_run_deno == 'true' }} | ||||||||||||||
| runs-on: ubuntu-latest | ||||||||||||||
| permissions: write-all | ||||||||||||||
| environment: ${{ needs.resolve-context.outputs.deno_environment }} | ||||||||||||||
|
|
||||||||||||||
| - uses: ubiquity-os/deno-plugin-adapter@main | ||||||||||||||
| if: ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' && github.event_name != 'delete' }} | ||||||||||||||
| id: adapter | ||||||||||||||
| with: | ||||||||||||||
| pluginEntry: "./worker" | ||||||||||||||
| steps: | ||||||||||||||
| - uses: actions/checkout@v6 | ||||||||||||||
|
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 🧩 Analysis chain🌐 Web query:
💡 Result: The latest stable release of Citations: Use The latest stable version of |
||||||||||||||
| if: ${{ needs.resolve-context.outputs.deno_action != 'delete' }} | ||||||||||||||
|
|
||||||||||||||
| - uses: ubiquity-os/deno-deploy@main | ||||||||||||||
| if: ${{ env.DEPLOY_DENO_ENABLED == 'true' && steps.refs.outputs.is_tag_ref != 'true' && steps.refs.outputs.is_artifact_ref != 'true' }} | ||||||||||||||
| env: | ||||||||||||||
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||||||||||||||
| KERNEL_PUBLIC_KEY: ${{ secrets.KERNEL_PUBLIC_KEY }} | ||||||||||||||
| APP_ID: ${{ secrets.APP_ID }} | ||||||||||||||
| APP_PRIVATE_KEY: ${{ secrets.APP_PRIVATE_KEY }} | ||||||||||||||
| APP_INSTALLATION_ID: ${{ secrets.APP_INSTALLATION_ID }} | ||||||||||||||
| ACTION_REF: ${{ env.ACTION_REF }} | ||||||||||||||
| LOG_LEVEL: ${{ secrets.LOG_LEVEL }} | ||||||||||||||
| SUPABASE_URL: ${{ secrets.SUPABASE_URL }} | ||||||||||||||
| SUPABASE_KEY: ${{ secrets.SUPABASE_KEY }} | ||||||||||||||
| with: | ||||||||||||||
| token: ${{ secrets.DENO_DEPLOY_TOKEN }} | ||||||||||||||
| action: ${{ github.event_name == 'delete' && 'delete' || 'deploy' }} | ||||||||||||||
| organization: ${{ secrets.DENO_ORG_NAME }} | ||||||||||||||
| entrypoint: ${{ github.event_name == 'delete' && 'src/deno.ts' || steps.adapter.outputs.entrypoint }} | ||||||||||||||
| project_name: ${{ secrets.DENO_PROJECT_NAME }} | ||||||||||||||
| sourceRef: ${{ steps.refs.outputs.source_ref }} | ||||||||||||||
| artifactPrefix: dist/ | ||||||||||||||
| action: ${{ needs.resolve-context.outputs.deno_action }} | ||||||||||||||
| app: ${{ secrets.DENO_PROJECT_NAME }} | ||||||||||||||
| entrypoint: src/worker.ts | ||||||||||||||
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Uh oh!
There was an error while loading. Please reload this page.