-
Notifications
You must be signed in to change notification settings - Fork 2
/
action.yml
44 lines (42 loc) · 1.57 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: "sitkoru/github-deployment-action"
description: "Action to manage GitHub Deployments"
branding:
icon: "package"
color: "blue"
inputs:
action:
description: "Deployment action"
required: true
default: "create"
version:
description: "Service version"
required: false
token:
description: "Github token"
required: true
environment:
description: "Github environment"
required: false
default: "production"
ref:
description: "Github ref"
required: false
deployment_id:
description: "Github deployment id"
required: false
state:
description: "Github deployment state"
required: false
runs:
using: "composite"
steps:
- name: Create new deployment
if: ${{ inputs.action == 'create' }}
shell: bash
run: |
curl -X POST -H "Authorization: token ${{ inputs.token }}" -H "Accept: application/vnd.github.ant-man-preview+json" -H "Content-Type: application/json" https://api.github.com/repos/${{ github.repository }}/deployments --data '{"ref": "${{ inputs.ref }}", "environment": "${{ inputs.environment }}", "description":"${{ inputs.version }}", "auto_merge": false, "required_contexts": []}'
- name: Update deployment
if: ${{ inputs.action == 'update' }}
shell: bash
run: |
curl -X POST -H "Authorization: token ${{ inputs.token }}" H "Accept: application/vnd.github.ant-man-preview+json"-H "Content-Type: application/json" https://api.github.com/repos/${{ github.repository }}/deployments/${{ inputs.deployment_id }}/statuses --data '{"state": "${{ inputs.state }}"}'