Skip to content

Deploy PR Review App to Control Plane #2

Deploy PR Review App to Control Plane

Deploy PR Review App to Control Plane #2

# Control Plane GitHub Action
name: Deploy-To-Control-Plane
# Controls when the workflow will run
on:
# Uncomment the lines you want actions that will cause the workflow to Triggers the workflow on push or pull request events but only for the main branch
# push:
# branches: [main]
# pull_request:
# branches: [main]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# Convert the GitHub secret variables to environment variables for use by the Control Plane CLI
env:
CPLN_ORG: ${{secrets.CPLN_ORG}}
CPLN_TOKEN: ${{secrets.CPLN_TOKEN}}
jobs:
deploy-to-control-plane:
runs-on: ubuntu-latest
steps:
- name: Check out the repo
uses: actions/checkout@v2
- name: Set up Ruby
uses: ruby/setup-ruby@v1
with:
ruby-version: '3.2' # Specify your Ruby version here
- name: Install Control Plane CLI
shell: bash
run: |
sudo npm install -g @controlplane/cli
cpln --version
gem install cpl -v 1.1.2
- name: setup-control-plane-tools-staging
run: |
cpln profile create default --token ${{ secrets.CPLN_TOKEN_STAGING }} --org ${{ secrets.CPLN_TOKEN_STAGING }} --gvc ${{ secrets.APP_NAME_STAGING }}
cpln image docker-login
- name: Set Short SHA
id: vars
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
- name: Get short SHA
id: short_sha
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
- name: Containerize and push image
run: |
cpl build-image -a ${{ secrets.APP_NAME_STAGING }} --commit ${env.SHORT_SHA::7}
# # Containerize and push the application to the org's private image repository. The tag is the short SHA of the commit.
# - name: Containerize application and push image
# shell: bash
# run: |
# cpln profile update default --token ${CPLN_TOKEN}
# cpln image docker-login
# cpln image build --name ${CPLN_IMAGE}:${{steps.vars.outputs.sha_short}} --dockerfile ./Dockerfile --push
##
## build-and-push: