-
Notifications
You must be signed in to change notification settings - Fork 0
/
action.yaml
98 lines (95 loc) · 3.49 KB
/
action.yaml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
name: Get Environment (wemogy)
author: wemogy
description: Detects on which branch or Pull Request a workflow is running on and derives an environment information from that.
branding:
icon: "git-branch"
color: "blue"
inputs:
github-token:
description: "GitHub Token"
required: true
prod-branch:
description: "Name of the branch that should result in environment 'prod'"
default: "prod"
required: true
prod-domain-prefix:
description: "Prefix to use in domains when environment is 'prod'"
default: ""
required: true
staging-branch:
description: "Name of the branch that should result in environment 'staging'"
default: "staging"
required: true
staging-domain-prefix:
description: "Prefix to use in domains when environment is 'staging'"
default: "staging"
required: true
dev-branch:
description: "Name of the branch that should result in environment 'dev'"
default: "main"
required: true
dev-domain-prefix:
description: "Prefix to use in domains when environment is 'dev'"
default: "dev"
required: true
pr-environment:
description: "Default environment that should be used for Pull Request deployments"
default: "dev"
required: true
pr-use-custom-environment:
description: "Should the Pull Request be deployed into a custom environment?"
default: "false"
required: true
deploy-label:
description: "Label to trigger the default deployment"
default: "deploy-to-dev"
required: true
deploy-to-custom-label:
description: "Label to trigger a deployment into a custom environment"
default: "deploy-to-custom"
required: true
outputs:
branch-name:
description: "Name of the current branch"
value: ${{ steps.check.outputs.branch-name }}
exact-match:
description: "Does the current branch exactly match one of the environments?"
value: ${{ steps.check.outputs.exact-match }}
is-pull-request:
description: "Is this running in context of a Pull Request?"
value: ${{ steps.check.outputs.is-pull-request }}
is-deployment-needed:
description: "Is a deployment needed?"
value: ${{ steps.check.outputs.is-deployment-needed }}
is-custom-environment:
description: "Should a custom environment be used?"
value: ${{ steps.check.outputs.is-custom-environment }}
env:
description: "The Environment this branch is targeting"
value: ${{ steps.check.outputs.env }}
domain-prefix:
description: "Prefix to use in domains"
value: ${{ steps.check.outputs.domain-prefix }}
slug:
description: "Environment slug to attach as suffix to versions and resources like Kubernetes namespaces"
value: ${{ steps.check.outputs.slug }}
runs:
using: "composite"
steps:
- name: Check
id: check
shell: bash
run: ${{ github.action_path }}/entrypoint.sh
env:
DEPLOY_LABEL: ${{ inputs.deploy-label }}
DEPLOY_CUSTOM_LABEL: ${{ inputs.deploy-to-custom-label }}
GITHUB_TOKEN: ${{ inputs.github-token }}
DEV_BRANCH: ${{ inputs.dev-branch }}
DEV_DOMAIN_PREFIX: ${{ inputs.dev-domain-prefix }}
STAGING_BRANCH: ${{ inputs.staging-branch }}
STAGING_DOMAIN_PREFIX: ${{ inputs.staging-domain-prefix }}
PROD_BRANCH: ${{ inputs.prod-branch }}
PROD_DOMAIN_PREFIX: ${{ inputs.prod-domain-prefix }}
PR_ENVIRONMENT: ${{ inputs.pr-environment }}
GITHUB_EVENT_PULL_REQUEST_NUMBER: ${{ github.event.pull_request.number }}
GITHUB_EVENT_LABEL_NAME: ${{ github.event.label.name }}