-
Notifications
You must be signed in to change notification settings - Fork 383
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Experiment with Building Image from Github Actions
- Loading branch information
Showing
1 changed file
with
66 additions
and
0 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,66 @@ | ||
# 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: |