Skip to content

Commit 2cbab12

Browse files
authored
Merge pull request #18 from STEM-C/develop
Capture student submissions
2 parents c3e8d5e + e06e823 commit 2cbab12

File tree

6 files changed

+6165
-62
lines changed

6 files changed

+6165
-62
lines changed

README.md

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -8,22 +8,16 @@ GitHub actions that enable an automated CI/CD pipeline
88

99
### Build-Test-Deploy
1010

11-
Build a docker image, run the testing harness, push to [GitHub Package Repository](https://github.com/STEM-C/CaSMM/packages) and [Heroku Container Registry](https://devcenter.heroku.com/articles/container-registry-and-runtime), and deploy the image to a target Heroku app
11+
Build docker images, run the testing harness, push to [GitHub Package Repository](https://github.com/STEM-C/CaSMM/packages) and [Heroku Container Registry](https://devcenter.heroku.com/articles/container-registry-and-runtime), and deploy the image to a target Heroku app
1212

1313
``` yaml
1414
inputs:
15-
image_name:
16-
description: 'Name of the github package repo image'
17-
required: true
1815
image_tag:
1916
description: 'Tag of the github package repo image'
2017
required: true
2118
app_name:
2219
description: 'Target Heroku app name'
2320
required: true
24-
app_type:
25-
description: 'Target Heroku app type'
26-
required: true
2721
github_token:
2822
description: 'Token for github package repo'
2923
required: true

build-test-deploy/action.yml

Lines changed: 0 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,27 +1,19 @@
11
name: 'Build-Test-Deploy'
22
description: 'Build, test, and deploy a target image to heroku'
33
inputs:
4-
image_name:
5-
description: 'Name of the github package repo image'
6-
required: true
74
image_tag:
85
description: 'Tag of the github package repo image'
96
required: true
107
app_name:
118
description: 'Target Heroku app name'
129
required: true
13-
app_type:
14-
description: 'Target Heroku app type'
15-
required: true
1610
github_token:
1711
description: 'Token for github package repo'
1812
required: true
1913
runs:
2014
using: 'docker'
2115
image: 'Dockerfile'
2216
args:
23-
- ${{ inputs.image_name }}
2417
- ${{ inputs.image_tag }}
2518
- ${{ inputs.app_name }}
26-
- ${{ inputs.app_type }}
2719
- ${{ inputs.github_token }}

build-test-deploy/entrypoint.sh

Lines changed: 31 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,35 @@
22

33
set -e
44

5-
if [[ "$#" != 5 ]];
5+
if [[ "$#" != 3 ]];
66
then
7-
echo "Expecting 5 arguments, got $#!"
7+
echo "Expecting 3 arguments, got $#!"
88
exit 0
99
fi;
1010

11-
image_name=$1
12-
image_tag=$2
13-
app_name=$3
14-
app_type=$4
15-
github_token=$5
11+
image_tag=$1
12+
app_name=$2
13+
github_token=$3
1614

17-
gpr_image_name="docker.pkg.github.com/stem-c/casmm/$image_name"
18-
heroku_image_name="registry.heroku.com/$app_name/$app_type"
15+
gpr_base="docker.pkg.github.com/stem-c/casmm"
16+
heroku_base="registry.heroku.com/$app_name"
1917

20-
# Build and tag image
18+
# Log into gpr
2119
echo "$github_token" | docker login docker.pkg.github.com -u "$GITHUB_ACTOR" --password-stdin
22-
docker pull "$gpr_image_name" || true
23-
docker build -t "$gpr_image_name:$image_tag" -t "$gpr_image_name:latest" -t "$heroku_image_name" --cache-from "$gpr_image_name" .
20+
21+
# Name and build server image
22+
gpr_server="$gpr_base/server"
23+
heroku_server="$heroku_base/web"
24+
25+
docker pull "$gpr_server" || true
26+
docker build -t "$gpr_server:$image_tag" -t "$gpr_server:latest" -t "$heroku_server" --cache-from "$gpr_server" .
27+
28+
# Name and build compile image
29+
gpr_compile="$gpr_base/compile"
30+
heroku_compile="$heroku_base/compile"
31+
32+
docker pull "$gpr_compile" || true
33+
docker build -t "$gpr_compile:$image_tag" -t "$gpr_compile:latest" -t "$heroku_compile" --cache-from "$gpr_compile" -f ./compile/Dockerfile ./compile
2434

2535
# Test
2636
# docker-compose up -d
@@ -33,13 +43,16 @@ docker build -t "$gpr_image_name:$image_tag" -t "$gpr_image_name:latest" -t "$he
3343
# yarn integration
3444
# yarn performance
3545

36-
# Push gpr image
37-
docker push "$gpr_image_name"
46+
# Push gpr images
47+
docker push "$gpr_server"
48+
docker push "$gpr_compile"
3849

39-
# Push heroku image
40-
# docker login --username=_ --password="$heroku_token" registry.heroku.com
50+
# Login to heroku container registry
4151
heroku container:login
42-
docker push "$heroku_image_name"
52+
53+
# Push heroku image
54+
docker push "$heroku_server"
55+
docker push "$heroku_compile"
4356

4457
# Deploy app
45-
heroku container:release -a "$app_name" web
58+
heroku container:release -a "$app_name" web compile

0 commit comments

Comments
 (0)