Repository navigation
chore(ci): consolidate deploy workflows #22
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
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
This file was deleted.
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1,24 +1,152 @@ | ||
| name: "Update Configuration and Build" | ||
| name: "Deploy" | ||
|
|
||
| on: | ||
| workflow_dispatch: | ||
| inputs: | ||
| build_action_enabled: | ||
| description: "Publish GitHub Action artifacts to dist/<ref>." | ||
| required: false | ||
| default: "true" | ||
| type: choice | ||
| options: | ||
| - "true" | ||
| - "false" | ||
| deploy_deno_enabled: | ||
| description: "Deploy Worker to Deno Deploy." | ||
| required: false | ||
| default: "true" | ||
| type: choice | ||
| options: | ||
| - "true" | ||
| - "false" | ||
| skip_bot_events: | ||
| description: "manifest.skipBotEvents value for generated manifest." | ||
| required: false | ||
| default: "false" | ||
| exclude_supported_events: | ||
| description: "Comma-separated supported events to exclude from manifest listeners." | ||
| required: false | ||
| default: "" | ||
| push: | ||
| branches-ignore: | ||
| - "dist/**" | ||
| tags-ignore: | ||
| - "*" | ||
| delete: | ||
|
|
||
| jobs: | ||
| update: | ||
| name: "Update Configuration & Build" | ||
| deploy: | ||
| name: "Deploy (Action / Deno)" | ||
| 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' }} | ||
| 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 || 'false' }} | ||
| EXCLUDE_SUPPORTED_EVENTS: ${{ github.event_name == 'workflow_dispatch' && inputs.exclude_supported_events || vars.EXCLUDE_SUPPORTED_EVENTS || '' }} | ||
|
|
||
| steps: | ||
| - uses: ubiquity-os/action-deploy-plugin@main | ||
| - name: Resolve source ref | ||
| id: refs | ||
| shell: bash | ||
| run: | | ||
| source_ref="$(echo '${{ github.event.ref || github.event.workflow_run.head_branch || github.ref }}' | sed 's#refs/heads/##' | sed 's#refs/tags/##')" | ||
| if [[ -z "$source_ref" ]]; then | ||
| source_ref="${GITHUB_REF_NAME}" | ||
| fi | ||
|
|
||
| is_tag_ref="false" | ||
| if [[ "${{ github.event.ref_type || '' }}" == "tag" ]] || [[ "${GITHUB_REF:-}" == refs/tags/* ]]; then | ||
| is_tag_ref="true" | ||
| fi | ||
|
|
||
| is_artifact_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}" | ||
| 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" | ||
|
Comment on lines
+75
to
+78
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: # First, get the actual lines from the workflow file
fd '.github/workflows/update-configuration.yml' -x cat {} | head -160 | tail -90Repository: ubiquity-os/command-demo Length of output: 50 🏁 Script executed: find . -name "update-configuration.yml" -type fRepository: ubiquity-os/command-demo Length of output: 112 🏁 Script executed: cat -n ./.github/workflows/update-configuration.yml | sed -n '70,85p'Repository: ubiquity-os/command-demo Length of output: 828 🏁 Script executed: cat -n ./.github/workflows/update-configuration.yml | sed -n '135,150p'Repository: ubiquity-os/command-demo Length of output: 1127 🌐 Web query:
💡 Result: What gets resolved when (expressions vs runtime)
|
||
|
|
||
| - name: Print deployment mode | ||
| shell: bash | ||
| 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}" | ||
|
|
||
| - 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' }} | ||
| treatAsEsm: true | ||
| sourcemap: false | ||
| sourcemap: true | ||
| pluginEntry: "${{ github.workspace }}/src/action.ts" | ||
| skipBotEvents: false | ||
| excludeSupportedEvents: ${{ env.EXCLUDE_SUPPORTED_EVENTS }} | ||
| skipBotEvents: ${{ env.SKIP_BOT_EVENTS }} | ||
| 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 | ||
|
Comment on lines
+114
to
+122
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 for deno configuration files
fd -t f "(deno\.json|deno\.lock|\.github/workflows)" | head -20Repository: ubiquity-os/command-demo Length of output: 50 🏁 Script executed: # Get the full context of the workflow file
cat -n .github/workflows/update-configuration.yml | head -130 | tail -40Repository: ubiquity-os/command-demo Length of output: 2438 🏁 Script executed: # Check if there's a deno.lock file in the repository
find . -name "deno.lock" -o -name "deno.json" 2>/dev/null | head -20Repository: ubiquity-os/command-demo Length of output: 50 🌐 Web query:
💡 Result:
Context: since Deno v1.28, Deno will automatically discover/use (and create/update) If you want to disable lockfiles via config instead of a CLI flag, you can set Citations:
🌐 Web query:
💡 Result: Deno’s lockfile “auto-discovery” works like this:
Sources: Citations:
Pin Deno version and plugin-manifest-tool to specific versions.
|
||
| env: | ||
| SKIP_BOT_EVENTS: ${{ env.SKIP_BOT_EVENTS }} | ||
| EXCLUDE_SUPPORTED_EVENTS: ${{ env.EXCLUDE_SUPPORTED_EVENTS }} | ||
| GITHUB_REF_NAME: ${{ steps.refs.outputs.source_ref }} | ||
|
|
||
| - 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" | ||
|
|
||
| - 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 }} | ||
| USER_GITHUB_TOKEN: ${{ secrets.USER_GITHUB_TOKEN }} | ||
| 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/ | ||
This file was deleted.
This file was deleted.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧩 Analysis chain
🏁 Script executed:
Repository: ubiquity-os/command-demo
Length of output: 7736
Pin actions to full SHAs and scope permissions.
Line 41's
permissions: write-allgrants unnecessary access toGITHUB_TOKEN. The unpinned cross-repo actions at lines 94, 128, and 134 reference@mainwhile receiving sensitive secrets (APP_ID, APP_PRIVATE_KEY, KERNEL_PUBLIC_KEY, GITHUB_TOKEN, APP_INSTALLATION_ID). If an action is compromised, it can access these secrets and write to the repository. Pin actions to full commit SHAs and restrict permissions to only what each step requires.