Skip to content

Commit e0568d0

Browse files
committed
Experiment with Building Image from Github Actions
1 parent 0f37aba commit e0568d0

File tree

1 file changed

+66
-0
lines changed

1 file changed

+66
-0
lines changed
Lines changed: 66 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,66 @@
1+
# Control Plane GitHub Action
2+
3+
name: Deploy-To-Control-Plane
4+
5+
# Controls when the workflow will run
6+
on:
7+
# 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
8+
9+
# push:
10+
# branches: [main]
11+
# pull_request:
12+
# branches: [main]
13+
14+
# Allows you to run this workflow manually from the Actions tab
15+
workflow_dispatch:
16+
17+
# Convert the GitHub secret variables to environment variables for use by the Control Plane CLI
18+
env:
19+
CPLN_ORG: ${{secrets.CPLN_ORG}}
20+
CPLN_TOKEN: ${{secrets.CPLN_TOKEN}}
21+
22+
jobs:
23+
deploy-to-control-plane:
24+
runs-on: ubuntu-latest
25+
26+
steps:
27+
- name: Check out the repo
28+
uses: actions/checkout@v2
29+
30+
- name: Set up Ruby
31+
uses: ruby/setup-ruby@v1
32+
with:
33+
ruby-version: '3.2' # Specify your Ruby version here
34+
35+
- name: Install Control Plane CLI
36+
shell: bash
37+
run: |
38+
sudo npm install -g @controlplane/cli
39+
cpln --version
40+
gem install cpl -v 1.1.2
41+
42+
- name: setup-control-plane-tools-staging
43+
run: |
44+
cpln profile create default --token ${{ secrets.CPLN_TOKEN_STAGING }} --org ${{ secrets.CPLN_TOKEN_STAGING }} --gvc ${{ secrets.APP_NAME_STAGING }}
45+
cpln image docker-login
46+
47+
- name: Set Short SHA
48+
id: vars
49+
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
50+
51+
- name: Get short SHA
52+
id: short_sha
53+
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
54+
55+
- name: Containerize and push image
56+
run: |
57+
cpl build-image -a ${{ secrets.APP_NAME_STAGING }} --commit ${env.SHORT_SHA::7}
58+
# # Containerize and push the application to the org's private image repository. The tag is the short SHA of the commit.
59+
# - name: Containerize application and push image
60+
# shell: bash
61+
# run: |
62+
# cpln profile update default --token ${CPLN_TOKEN}
63+
# cpln image docker-login
64+
# cpln image build --name ${CPLN_IMAGE}:${{steps.vars.outputs.sha_short}} --dockerfile ./Dockerfile --push
65+
##
66+
## build-and-push:

0 commit comments

Comments
 (0)