Skip to content

Commit 0853636

Browse files
committed
feat: allow a workflow to specify an environment name
1 parent bf880b4 commit 0853636

File tree

3 files changed

+10
-1
lines changed

3 files changed

+10
-1
lines changed

README.md

+4
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ The PHP version to use. This is directly passed to [`shivammathur/setup-php`](ht
2424

2525
An option to force push changes to the project repository on Platform.sh. Use with caution as force push overrides your commit history.
2626

27+
### `environment-name`
28+
29+
The name of the platform.sh instance on which to act. Default: The current branch name.
30+
2731
## Outputs
2832

2933
No outputs.

action.yml

+4
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,9 @@ inputs:
1717
force-push:
1818
description: 'Force push to Platform.sh'
1919
required: false
20+
environment-name:
21+
description: 'Name of the platform.sh instance'
22+
required: false
2023
runs:
2124
using: "composite"
2225
steps:
@@ -36,6 +39,7 @@ runs:
3639
PLATFORM_PROJECT_ID: ${{ inputs.project-id }}
3740
PLATFORMSH_CLI_TOKEN: ${{ inputs.cli-token }}
3841
FORCE_PUSH: ${{ inputs.force-push }}
42+
ENVIRONMENT_NAME: ${{ inputs.environment-name }}
3943
branding:
4044
icon: upload-cloud
4145
color: orange

deploy.sh

+2-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,8 @@ mkdir -p ~/.ssh && chmod 0700 ~/.ssh
1111
cat ${GITHUB_ACTION_PATH}/known_hosts >> ~/.ssh/known_hosts
1212

1313
platform project:set-remote ${PLATFORM_PROJECT_ID}
14-
PLATFORM_OPTS="-vv --activate --target ${GITHUB_REF_NAME}"
14+
[[ "$ENVIRONMENT_NAME" == "" ]] && ENVIRONMENT_NAME="$GITHUB_REF_NAME"
15+
PLATFORM_OPTS="-vv --activate --target $ENVIRONMENT_NAME"
1516
if [[ -n "$FORCE_PUSH" ]]; then
1617
PLATFORM_OPTS="$PLATFORM_OPTS --force"
1718
fi

0 commit comments

Comments
 (0)