Skip to content

Commit

Permalink
Experiment with Building Image from Github Actions
Browse files Browse the repository at this point in the history
  • Loading branch information
justin808 committed Dec 28, 2023
1 parent 0f37aba commit e0568d0
Showing 1 changed file with 66 additions and 0 deletions.
66 changes: 66 additions & 0 deletions .github/workflows/deploy-to-control-plane.yml
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:

0 comments on commit e0568d0

Please sign in to comment.