Skip to content

Commit f60859f

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

File tree

1 file changed

+61
-0
lines changed

1 file changed

+61
-0
lines changed
Lines changed: 61 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,61 @@
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: Install Control Plane CLI
31+
shell: bash
32+
run: |
33+
sudo npm install -g @controlplane/cli
34+
cpln --version
35+
gem install cpl -v 1.1.2
36+
37+
- name: setup-control-plane-tools-staging
38+
run: |
39+
cpln profile create default --token ${{ secrets.CPLN_TOKEN_STAGING }} --org ${{ secrets.CPLN_TOKEN_STAGING }} --gvc ${{ secrets.APP_NAME_STAGING }}
40+
cpln image docker-login
41+
42+
- name: Set Short SHA
43+
id: vars
44+
run: echo "::set-output name=sha_short::$(git rev-parse --short HEAD)"
45+
46+
- name: Get short SHA
47+
id: short_sha
48+
run: echo "SHORT_SHA=$(git rev-parse --short HEAD)" >> $GITHUB_ENV
49+
50+
- name: Containerize and push image
51+
run: |
52+
cpl build-image -a ${{ secrets.APP_NAME_STAGING }} --commit ${env.SHORT_SHA::7}
53+
# # Containerize and push the application to the org's private image repository. The tag is the short SHA of the commit.
54+
# - name: Containerize application and push image
55+
# shell: bash
56+
# run: |
57+
# cpln profile update default --token ${CPLN_TOKEN}
58+
# cpln image docker-login
59+
# cpln image build --name ${CPLN_IMAGE}:${{steps.vars.outputs.sha_short}} --dockerfile ./Dockerfile --push
60+
##
61+
## build-and-push:

0 commit comments

Comments
 (0)