add
This commit is contained in:
+44
-65
@@ -1,82 +1,61 @@
|
|||||||
name: Workflow Dispatch Example
|
name: Workflow with Inputs
|
||||||
|
|
||||||
on:
|
on:
|
||||||
workflow_dispatch:
|
workflow_dispatch:
|
||||||
inputs:
|
inputs:
|
||||||
environment:
|
string_input:
|
||||||
description: 'The environment to deploy to'
|
description: 'A string input'
|
||||||
required: true
|
required: true
|
||||||
default: 'production'
|
default: 'default string'
|
||||||
type: string
|
type: string
|
||||||
branch:
|
boolean_input:
|
||||||
description: 'The branch to deploy'
|
description: 'A boolean input'
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
tag:
|
|
||||||
description: 'The tag to deploy'
|
|
||||||
required: true
|
|
||||||
type: string
|
|
||||||
force_deploy:
|
|
||||||
description: 'Force deployment'
|
|
||||||
required: false
|
required: false
|
||||||
|
default: false
|
||||||
type: boolean
|
type: boolean
|
||||||
notify:
|
number_input:
|
||||||
description: 'Notify users'
|
description: 'A number input'
|
||||||
required: false
|
required: true
|
||||||
type: boolean
|
default: 42
|
||||||
slack_channel:
|
|
||||||
description: 'Slack channel to notify'
|
|
||||||
required: false
|
|
||||||
type: string
|
|
||||||
parallel_jobs:
|
|
||||||
description: 'Number of parallel jobs'
|
|
||||||
required: false
|
|
||||||
type: number
|
type: number
|
||||||
timeout:
|
array_input:
|
||||||
description: 'Timeout duration in minutes'
|
description: 'An array input'
|
||||||
required: false
|
|
||||||
type: integer
|
|
||||||
config_file:
|
|
||||||
description: 'Path to custom configuration file'
|
|
||||||
required: false
|
|
||||||
type: path
|
|
||||||
matrix:
|
|
||||||
description: 'Matrix configuration'
|
|
||||||
required: false
|
required: false
|
||||||
|
default: ['item1', 'item2']
|
||||||
type: array
|
type: array
|
||||||
image:
|
object_input:
|
||||||
description: 'Docker image to use for the job'
|
description: 'An object input'
|
||||||
required: false
|
required: true
|
||||||
|
default: '{"key": "value"}'
|
||||||
type: object
|
type: object
|
||||||
|
enum_input:
|
||||||
|
description: 'An enum input'
|
||||||
|
required: true
|
||||||
|
default: 'option1'
|
||||||
|
type: string
|
||||||
|
enum:
|
||||||
|
- option1
|
||||||
|
- option2
|
||||||
|
file_input:
|
||||||
|
description: 'A file input'
|
||||||
|
required: true
|
||||||
|
type: path
|
||||||
|
env_var_input:
|
||||||
|
description: 'An environment variable input'
|
||||||
|
required: true
|
||||||
|
type: env
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
deploy:
|
build:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
steps:
|
steps:
|
||||||
- name: Check out repository
|
- name: Print Inputs
|
||||||
uses: actions/checkout@v2
|
|
||||||
|
|
||||||
- name: Deploy to ${{ github.event.inputs.environment }}
|
|
||||||
run: |
|
run: |
|
||||||
echo "Deploying branch: ${{ github.event.inputs.branch }}"
|
echo "String Input: ${{ github.event.inputs.string_input }}"
|
||||||
echo "Deploying tag: ${{ github.event.inputs.tag }}"
|
echo "Boolean Input: ${{ github.event.inputs.boolean_input }}"
|
||||||
if [ "${{ github.event.inputs.force_deploy }}" = "true" ]; then
|
echo "Number Input: ${{ github.event.inputs.number_input }}"
|
||||||
echo "Forcing deployment"
|
echo "Array Input: ${{ github.event.inputs.array_input }}"
|
||||||
fi
|
echo "Object Input: ${{ github.event.inputs.object_input }}"
|
||||||
if [ "${{ github.event.inputs.notify }}" = "true" ]; then
|
echo "Enum Input: ${{ github.event.inputs.enum_input }}"
|
||||||
echo "Notifying users"
|
echo "File Input: ${{ github.event.inputs.file_input }}"
|
||||||
fi
|
echo "Env Var Input: ${{ github.event.inputs.env_var_input }}"
|
||||||
if [ "${{ github.event.inputs.slack_channel }}" ]; then
|
|
||||||
echo "Notifying Slack channel: ${{ github.event.inputs.slack_channel }}"
|
|
||||||
fi
|
|
||||||
echo "Number of parallel jobs: ${{ github.event.inputs.parallel_jobs }}"
|
|
||||||
echo "Timeout duration: ${{ github.event.inputs.timeout }} minutes"
|
|
||||||
if [ "${{ github.event.inputs.config_file }}" ]; then
|
|
||||||
echo "Using custom config file: ${{ github.event.inputs.config_file }}"
|
|
||||||
fi
|
|
||||||
if [ "${{ github.event.inputs.matrix }}" ]; then
|
|
||||||
echo "Matrix configuration: ${{ github.event.inputs.matrix }}"
|
|
||||||
fi
|
|
||||||
if [ "${{ github.event.inputs.image }}" ]; then
|
|
||||||
echo "Docker image to use: ${{ github.event.inputs.image }}"
|
|
||||||
fi
|
|
||||||
|
|||||||
Reference in New Issue
Block a user