Deploy Review App to Control Plane #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# Control Plane GitHub Action | |
name: Deploy Review App to Control Plane | |
# Controls when the workflow will run | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
# inputs: | |
# pr_number: | |
# description: 'Pull request number' | |
# required: false | |
# Triggers the workflow on pull request events | |
# pull_request: | |
# branches: | |
# - main # or the branch you want to trigger the workflow | |
# Convert the GitHub secret variables to environment variables for use by the Control Plane CLI | |
env: | |
CPLN_ORG: ${{secrets.CPLN_ORG_STAGING}} | |
CPLN_TOKEN: ${{secrets.CPLN_TOKEN_STAGING}} | |
jobs: | |
deploy-to-control-plane-staging: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out the repo | |
uses: actions/checkout@v2 | |
- name: Extract PR number from branch name | |
run: | | |
PR_NUMBER=$(echo ${GITHUB_REF#refs/heads/pr-}) | |
if [ -z "$PR_NUMBER" ]; then | |
echo "PR_NUMBER is not set. Aborting." | |
exit 1 | |
fi | |
echo "PR_NUMBER=$PR_NUMBER" >> $GITHUB_ENV | |
- uses: ./.github/actions/deploy-to-control-plane | |
with: | |
app_name: qa-react-webpack-rails-tutorial-pr-${{ env.PR_NUMBER }} | |
org: ${{ secrets.CPLN_ORG_STAGING }} |