-
Notifications
You must be signed in to change notification settings - Fork 384
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
69 additions
and
48 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
# Control Plane GitHub Action | ||
|
||
name: Deploy-To-Control-Plane | ||
description: Deploys both to staging and to review apps | ||
|
||
inputs: | ||
# The name of the app to deploy | ||
app_name: | ||
description: 'The name of the app to deploy' | ||
required: true | ||
default: 'react-webpack-rails-tutorial' | ||
|
||
env: | ||
CPLN_ORG: ${{secrets.CPLN_ORG_STAGING}} | ||
CPLN_TOKEN: ${{secrets.CPLN_TOKEN_STAGING}} | ||
|
||
runs: | ||
- 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.2.0 | ||
- name: Set Short SHA | ||
id: vars | ||
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)" | ||
|
||
- name: cpl profile | ||
run: | | ||
cpln profile update default | ||
# cpln profile update default --token ${CPLN_TOKEN} | ||
|
||
# Caching step | ||
- uses: actions/cache@v2 | ||
with: | ||
path: /tmp/.docker-cache | ||
key: ${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile', '**/package.json', '**/yarn.lock') }}-${{ github.sha }} | ||
restore-keys: | | ||
${{ runner.os }}-docker-${{ hashFiles('**/Dockerfile', '**/package.json', '**/yarn.lock') }} | ||
${{ runner.os }}-docker- | ||
- name: cpl build-image | ||
run: | | ||
cpln image docker-login | ||
cpl build-image -a ${{ inputs.app_name }} --commit ${{steps.vars.outputs.sha_short}} --org ${{secrets.CPLN_ORG_STAGING}} | ||
- name: Run release script | ||
run: | | ||
# Run database migrations (or other release tasks) with the latest image, | ||
# while the app is still running on the previous image. | ||
# This is analogous to the release phase. | ||
cpl run:detached './.controlplane/release_script.sh' -a ${{ inputs.app_name }} --image latest | ||
- name: Deploy to Control Plane | ||
run: | | ||
cpl deploy-image -a ${{ inputs.app_name }} --org ${{secrets.CPLN_ORG_STAGING}} |
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