File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 1+ name : Coswarm Deploy
2+
3+ on :
4+ workflow_dispatch :
5+
6+ jobs :
7+ deploy :
8+ runs-on : ubuntu-latest
9+ steps :
10+ - name : Checkout repository
11+ uses : actions/checkout@v4
12+
13+ - name : Install Go
14+ uses : actions/setup-go@v6
15+ with :
16+ go-version : " ^1.25"
17+
18+ - name : Deploy via Coswarm action
19+ uses : ./
20+ with :
21+ token : ${{ secrets.COSWARM_DEPLOY_TOKEN }}
22+ image : ${{ secrets.COSWARM_IMAGE }}
23+ base-url : ${{ secrets.COSWARM_API_URL }}
Original file line number Diff line number Diff line change 1+ node_modules
2+ .env
3+ yarn-error.log
Original file line number Diff line number Diff line change 1+ # Coswarm Deploy GitHub Action
2+
3+ This action sends a deployment request to the Coswarm API. It replicates the manual ` curl ` call:
4+
5+ ```
6+ curl -L 'http://localhost:3000/api/v1/apps/deploy' \
7+ -H 'Content-Type: application/json' \
8+ -d '{"token":"app_29fd8aa20b9d48506fe243ec925dec74","image":"redis:alpine"}'
9+ ```
10+
11+ ## Inputs
12+
13+ | Name | Required | Description |
14+ | ---- | -------- | ----------- |
15+ | ` token ` | Yes | Deployment token. Store this in a secret such as ` COSWARM_DEPLOY_TOKEN ` . |
16+ | ` image ` | Yes | Container image reference, e.g. ` redis:alpine ` . |
17+ | ` base-url ` | Yes | Coswarm API base URL. |
18+
19+ ## Example workflow
20+
21+ ``` yaml
22+ name : Coswarm Deploy
23+
24+ on :
25+ workflow_dispatch :
26+
27+ jobs :
28+ deploy :
29+ runs-on : ubuntu-latest
30+ steps :
31+ - name : Checkout
32+ uses : actions/checkout@v4
33+
34+ - name : Install Go
35+ uses : actions/setup-go@v6
36+ with :
37+ go-version : " ^1.25"
38+
39+ - name : Coswarm Deploy
40+ uses : kintsdev/coswarm-deploy@latest
41+ with :
42+ base-url : ${{ secrets.COSWARM_API_URL }}
43+ token : ${{ secrets.COSWARM_DEPLOY_TOKEN }}
44+ image : redis:alpine
45+ ` ` `
Original file line number Diff line number Diff line change 1+ name : " Coswarm Deploy"
2+ description : " Trigger the Coswarm deployment API with a Docker image reference."
3+ author : " Coswarm"
4+ inputs :
5+ token :
6+ description : " API token with permission to deploy the app."
7+ required : true
8+ image :
9+ description : " Container image tag to deploy. Example: redis:alpine"
10+ required : true
11+ base-url :
12+ description : " Coswarm API base URL. Must be provided explicitly."
13+ required : true
14+ runs :
15+ using : " composite"
16+ steps :
17+ - id : deploy
18+ shell : bash
19+ run : |
20+ set -euo pipefail
21+ BASE_URL="${{ inputs.base-url }}"
22+ if [[ -z "${BASE_URL}" ]]; then
23+ echo "Error: inputs.base-url must be set." >&2
24+ exit 1
25+ fi
26+ # Ensure the URL has no trailing slash before appending the endpoint
27+ API_URL="${BASE_URL%%/}/api/v1/apps/deploy"
28+ echo "Triggering deploy via ${API_URL}"
29+ curl -sS -L "${API_URL}" \
30+ -H 'Content-Type: application/json' \
31+ -d "$(jq -n --arg token "${{ inputs.token }}" --arg image "${{ inputs.image }}" '{token:$token,image:$image}')"
32+ branding :
33+ icon : " cloud"
34+ color : " blue"
You can’t perform that action at this time.
0 commit comments