Files
ci-actions/pipeline/action.yml
T
2026-09-26 05:57:32 +00:00

111 lines
3.8 KiB
YAML

name: DealSage custom app pipeline
description: >-
Runs the checks declared in .dealsage/app.json, builds the app with the
DealSage connection baked in, uploads the bundle, and asks DealSage to
release it under the app's publish policy. Platform-owned: app repos call
this action from a one-step workflow, so pipeline changes ship here, not in
every repo.
author: DealSage
inputs:
publish-token:
description: The app's PUBLISH_TOKEN repo secret (appId-scoped, minted by DealSage).
required: true
node-version:
description: Node.js version for install, checks and build.
required: false
default: "20"
install-command:
description: Dependency install command run in the repo root.
required: false
default: npm install --no-audit --no-fund
skip-publish:
description: Run checks and build only; do not allocate or upload a version.
required: false
default: "false"
outputs:
version:
description: The version number allocated for this build (empty when skip-publish).
value: ${{ steps.publish.outputs.version }}
promoted:
description: "true when DealSage promoted this version to live under the app's policy."
value: ${{ steps.publish.outputs.promoted }}
channel:
description: The channel the version landed on (live, or branch/<name>).
value: ${{ steps.publish.outputs.channel }}
# Environment the caller provides (from org variables/secrets, see the template
# workflow): DEALSAGE_FUNCTIONS_URL, SUPABASE_URL, SUPABASE_ANON_KEY, and either
# CUSTOM_APPS_WORKER_URL (upload through the Worker) or R2_ACCOUNT_ID,
# R2_BUCKET, R2_ACCESS_KEY_ID, R2_SECRET_ACCESS_KEY (S3 upload).
#
# Gitea shows this whole action as one step of the job, so the scripts report
# the steps below to DealSage themselves (lib.sh, "Pipeline steps") and the
# build page in the app hub lists them. PIPELINE_STEPS in lib.sh names them in
# this order; keep the two in step.
runs:
using: composite
steps:
- name: Tooling
shell: bash
run: bash "${{ github.action_path }}/scripts/ensure-tools.sh"
- name: Read the app manifest
shell: bash
run: bash "${{ github.action_path }}/scripts/manifest.sh"
- name: Record the build
shell: bash
env:
PUBLISH_TOKEN: ${{ inputs.publish-token }}
run: bash "${{ github.action_path }}/scripts/start-build.sh"
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: ${{ inputs.node-version }}
- name: Install dependencies
shell: bash
env:
PUBLISH_TOKEN: ${{ inputs.publish-token }}
INSTALL_COMMAND: ${{ inputs.install-command }}
run: bash "${{ github.action_path }}/scripts/install.sh"
- name: Checks
shell: bash
env:
PUBLISH_TOKEN: ${{ inputs.publish-token }}
run: bash "${{ github.action_path }}/scripts/run-checks.sh"
- name: Build
shell: bash
env:
PUBLISH_TOKEN: ${{ inputs.publish-token }}
run: bash "${{ github.action_path }}/scripts/build.sh"
- name: Publish
id: publish
if: inputs.skip-publish != 'true'
shell: bash
env:
PUBLISH_TOKEN: ${{ inputs.publish-token }}
run: bash "${{ github.action_path }}/scripts/publish.sh"
- name: Close the build record (no publish)
if: inputs.skip-publish == 'true'
shell: bash
env:
PUBLISH_TOKEN: ${{ inputs.publish-token }}
run: bash "${{ github.action_path }}/scripts/finish-build.sh" checked
# Runs whatever happened above: settles the step list with how the run
# ended and closes a build record no script got to close.
- name: Report the steps
if: always()
shell: bash
env:
PUBLISH_TOKEN: ${{ inputs.publish-token }}
run: bash "${{ github.action_path }}/scripts/finish-steps.sh"