-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yml
44 lines (41 loc) · 1.54 KB
/
action.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: 'Sammy deployment action'
description: 'This action triggers a deployment workflow'
inputs:
service:
description: 'Application service name'
required: true
type:
description: 'The deployment type <compose | kuberbetes | nomad>'
required: true
env:
description: "env your app should be deployed to"
required: true
default: "stage"
patch-field:
description: 'The path to the image you want to update <.services.api.image>'
required: true
patch-value:
description: 'The deployment new image'
required: true
file:
description: 'The name of the file you want to edit <docker-compose.yaml>'
required: true
gh-token:
required: false
description: 'The github token'
default: ${{ github.token }}
runs:
using: "composite"
steps:
- name: "deploy"
shell: bash
run: |
set -e
SERVICE=${{ inputs.service }}
ENVIRONMENT=${{ inputs.env }}
PATCH_FIELD=${{ inputs.patch-field }}
PATCH_VALUE=${{ inputs.patch-value }}
TYPE=${{ inputs.type }}
FILE=${{ inputs.file }}
GITHUB_TOKEN=${{ inputs.gh-token }}
curl --fail-with-body -X POST -H "Accept: application/vnd.github.v3+json" -H "Authorization: token $GITHUB_TOKEN" https://api.github.com/repos/osscameroon/deployments/actions/workflows/deploy-service.yaml/dispatches -d '{"ref": "main", "inputs": {"service": "'"$SERVICE"'", "env": "'"$ENVIRONMENT"'", "patch-field": "'"$PATCH_FIELD"'", "patch-value": "'"$PATCH_VALUE"'", "type": "'"$TYPE"'", "file-name": "'"$FILE"'"}}'