Skip to content

Commit 4d55edc

Browse files
committed
Address Devin feedback on GHA
1 parent fae9fd6 commit 4d55edc

3 files changed

Lines changed: 51 additions & 31 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 24 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ on:
1212
DOCKER_TAG:
1313
type: 'string'
1414
required: true
15-
BUILD_ENGINE_BUILD_TAG:
15+
BUILD_ENGINE_TAG:
1616
type: 'string'
1717
required: true
18-
OTEL_BUILD_TAG:
18+
OTEL_TAG:
1919
type: 'string'
2020
required: true
2121
secrets:
@@ -32,10 +32,24 @@ jobs:
3232
deploy-to-ecr:
3333
runs-on: ubuntu-latest
3434
steps:
35+
- name: Install dependencies
36+
run: |
37+
echo "Installing ecs-deploy script..."
38+
mkdir -p $HOME/.local/bin
39+
curl -o $HOME/.local/bin/ecs-deploy https://raw.githubusercontent.com/silinternational/ecs-deploy/master/ecs-deploy
40+
chmod +x $HOME/.local/bin/ecs-deploy
41+
42+
- name: Login to GitHub Container Registry
43+
uses: docker/login-action@v2
44+
with:
45+
registry: ghcr.io
46+
username: ${{ github.repository_owner }}
47+
password: ${{ secrets.GITHUB_TOKEN }}
48+
3549
- name: Pull from GHCR
3650
run: |
37-
docker pull ghcr.io/sillsdev/appbuilder-buildengine-api:${{ inputs.DOCKER_TAG }}
38-
docker pull ghcr.io/sillsdev/appbuilder-buildengine-otel:${{ inputs.DOCKER_TAG }}
51+
docker pull ghcr.io/${{ inputs.BUILD_ENGINE_TAG }}
52+
docker pull ghcr.io/${{ inputs.OTEL_TAG }}
3953
4054
- name: Configure AWS credentials
4155
id: aws
@@ -55,15 +69,15 @@ jobs:
5569
id: vars
5670
run: |
5771
echo "Setting up deployment variables..."
58-
echo "IMAGE_URL=${{ steps.ecr.outputs.registry }}/appbuilder-buildengine-api-origin" >> $GITHUB_OUTPUT
59-
echo "OTEL_URL=${{ steps.ecr.outputs.registry }}/appbuilder-buildengine-api-otel-collector" >> $GITHUB_OUTPUT
72+
echo "IMAGE_URL=${{ steps.ecr.outputs.registry }}/appbuilder-buildengine-api" >> $GITHUB_OUTPUT
73+
echo "OTEL_URL=${{ steps.ecr.outputs.registry }}/appbuilder-buildengine-otel" >> $GITHUB_OUTPUT
6074
6175
- name: Push to AWS ECR
6276
run: |
63-
docker tag ${{ inputs.BUILD_ENGINE_BUILD_TAG}} "${{ steps.vars.outputs.IMAGE_URL }}:${{ inputs.DOCKER_TAG }}"
64-
docker tag ${{ inputs.BUILD_ENGINE_BUILD_TAG}} "${{ steps.vars.outputs.IMAGE_URL }}:${{ inputs.BUILD_NUMBER }}"
65-
docker tag ${{ inputs.OTEL_BUILD_TAG}} "${{ steps.vars.outputs.OTEL_URL }}:${{ inputs.DOCKER_TAG }}"
66-
docker tag ${{ inputs.OTEL_BUILD_TAG}} "${{ steps.vars.outputs.OTEL_URL }}:${{ inputs.BUILD_NUMBER }}"
77+
docker tag ${{ inputs.BUILD_ENGINE_TAG}} "${{ steps.vars.outputs.IMAGE_URL }}:${{ inputs.DOCKER_TAG }}"
78+
docker tag ${{ inputs.BUILD_ENGINE_TAG}} "${{ steps.vars.outputs.IMAGE_URL }}:${{ inputs.BUILD_NUMBER }}"
79+
docker tag ${{ inputs.OTEL_TAG}} "${{ steps.vars.outputs.OTEL_URL }}:${{ inputs.DOCKER_TAG }}"
80+
docker tag ${{ inputs.OTEL_TAG}} "${{ steps.vars.outputs.OTEL_URL }}:${{ inputs.BUILD_NUMBER }}"
6781
echo "Docker images tagged as ${{ inputs.DOCKER_TAG }} and ${{ inputs.BUILD_NUMBER }}"
6882
6983
docker push "${{ steps.vars.outputs.IMAGE_URL }}:${{ inputs.DOCKER_TAG }}"

.github/workflows/main.yml

Lines changed: 27 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -2,15 +2,14 @@ name: BuildEngine v2 Test and Deploy
22

33
on:
44
push:
5+
branches:
6+
- master
7+
- develop
58
workflow_dispatch:
69
inputs:
710
tags:
811
description: "Tags"
912

10-
env:
11-
BUILD_ENGINE_BUILD_TAG: "build-engine-api:${{ github.run_number }}"
12-
OTEL_BUILD_TAG: "build-engine-otel:${{ github.run_number }}"
13-
1413
jobs:
1514
check:
1615
uses: "./.github/workflows/setup.yml"
@@ -22,8 +21,8 @@ jobs:
2221
outputs:
2322
DOCKER_TAG: ${{ steps.branch.outputs.DOCKER_TAG }}
2423
ECS_CLUSTER: ${{ steps.branch.outputs.ECS_CLUSTER }}
25-
BUILD_ENGINE_BUILD_TAG: ${{ env.BUILD_ENGINE_BUILD_TAG }}
26-
OTEL_BUILD_TAG: ${{ env.OTEL_BUILD_TAG }}
24+
BUILD_ENGINE_TAG: ${{ steps.push.outputs.BUILD_ENGINE_TAG }}
25+
OTEL_TAG: ${{ steps.push.outputs.OTEL_TAG }}
2726
if: ${{ success() && (github.ref == 'refs/heads/develop' || github.ref == 'refs/heads/master') }}
2827
steps:
2928
- name: Checkout
@@ -44,11 +43,16 @@ jobs:
4443
echo "ECS_CLUSTER=${ECS_CLUSTER}" >> $GITHUB_OUTPUT
4544
4645
- name: Build Docker images
46+
id: build
4747
run: |
48+
BUILD_ENGINE_BUILD_TAG="build-engine-api:${{ github.run_number }}"
49+
OTEL_BUILD_TAG="build-engine-otel:${{ github.run_number }}"
4850
echo "Building Docker images..."
49-
docker build -t ${{ env.BUILD_ENGINE_BUILD_TAG}} .
50-
docker build -t ${{ env.OTEL_BUILD_TAG}} -f Dockerfile.otel .
51+
docker build -t $BUILD_ENGINE_BUILD_TAG .
52+
docker build -t $OTEL_BUILD_TAG -f Dockerfile.otel .
5153
echo "Docker images built successfully."
54+
echo "BUILD_ENGINE_BUILD_TAG=${BUILD_ENGINE_BUILD_TAG}" >> $GITHUB_OUTPUT
55+
echo "BUILD_ENGINE_BUILD_TAG=${OTEL_BUILD_TAG}" >> $GITHUB_OUTPUT
5256
5357
- name: Login to GitHub Container Registry
5458
uses: docker/login-action@v2
@@ -58,12 +62,17 @@ jobs:
5862
password: ${{ secrets.GITHUB_TOKEN }}
5963

6064
- name: Push to GHCR
65+
id: push
6166
run: |
62-
docker tag ${{ env.BUILD_ENGINE_BUILD_TAG }} ghcr.io/sillsdev/appbuilder-buildengine-api:${{ steps.branch.outputs.DOCKER_TAG }}
63-
docker push ghcr.io/sillsdev/appbuilder-buildengine-api:${{ steps.branch.outputs.DOCKER_TAG }}
67+
BUILD_ENGINE_TAG="sillsdev/appbuilder-buildengine-api:${{ steps.branch.outputs.DOCKER_TAG }}"
68+
docker tag ${{ steps.build.outputs.BUILD_ENGINE_BUILD_TAG }} ghcr.io/${BUILD_ENGINE_TAG}
69+
docker push ghcr.io/${BUILD_ENGINE_TAG}
70+
echo "BUILD_ENGINE_TAG=${BUILD_ENGINE_TAG}" >> $GITHUB_OUTPUT
6471
65-
docker tag ${{ env.OTEL_BUILD_TAG }} ghcr.io/sillsdev/appbuilder-buildengine-otel:${{ steps.branch.outputs.DOCKER_TAG }}
66-
docker push ghcr.io/sillsdev/appbuilder-buildengine-otel:${{ steps.branch.outputs.DOCKER_TAG }}
72+
OTEL_TAG="sillsdev/appbuilder-buildengine-otel:${{ steps.branch.outputs.DOCKER_TAG }}"
73+
docker tag ${{ steps.build.outputs.OTEL_BUILD_TAG }} ghcr.io/${OTEL_TAG}
74+
docker push ghcr.io/${OTEL_TAG}
75+
echo "OTEL_TAG=${OTEL_TAG}" >> $GITHUB_OUTPUT
6776
6877
deploy-sil:
6978
needs: push-to-ghcr
@@ -72,8 +81,8 @@ jobs:
7281
BUILD_NUMBER: ${{ github.run_number }}
7382
ECS_CLUSTER: ${{ needs.push-to-ghcr.outputs.ECS_CLUSTER }}
7483
DOCKER_TAG: ${{ needs.push-to-ghcr.outputs.DOCKER_TAG }}
75-
BUILD_ENGINE_BUILD_TAG: ${{ needs.push-to-ghcr.outputs.BUILD_ENGINE_BUILD_TAG }}
76-
OTEL_BUILD_TAG: ${{ needs.push-to-ghcr.outputs.OTEL_BUILD_TAG }}
84+
BUILD_ENGINE_TAG: ${{ needs.push-to-ghcr.outputs.BUILD_ENGINE_TAG }}
85+
OTEL_TAG: ${{ needs.push-to-ghcr.outputs.OTEL_TAG }}
7786
secrets:
7887
AWS_ACCESS_KEY_ID: ${{ secrets.SIL__AWS_ACCESS_KEY_ID }}
7988
AWS_SECRET_ACCESS_KEY: ${{ secrets.SIL__AWS_SECRET_ACCESS_KEY }}
@@ -88,8 +97,8 @@ jobs:
8897
BUILD_NUMBER: ${{ github.run_number }}
8998
ECS_CLUSTER: ${{ needs.push-to-ghcr.outputs.ECS_CLUSTER }}
9099
DOCKER_TAG: ${{ needs.push-to-ghcr.outputs.DOCKER_TAG }}
91-
BUILD_ENGINE_BUILD_TAG: ${{ needs.push-to-ghcr.outputs.BUILD_ENGINE_BUILD_TAG }}
92-
OTEL_BUILD_TAG: ${{ needs.push-to-ghcr.outputs.OTEL_BUILD_TAG }}
100+
BUILD_ENGINE_TAG: ${{ needs.push-to-ghcr.outputs.BUILD_ENGINE_TAG }}
101+
OTEL_TAG: ${{ needs.push-to-ghcr.outputs.OTEL_TAG }}
93102
secrets:
94103
AWS_ACCESS_KEY_ID: ${{ secrets.FCBH__AWS_ACCESS_KEY_ID }}
95104
AWS_SECRET_ACCESS_KEY: ${{ secrets.FCBH__AWS_SECRET_ACCESS_KEY }}
@@ -103,8 +112,8 @@ jobs:
103112
BUILD_NUMBER: ${{ github.run_number }}
104113
ECS_CLUSTER: ${{ needs.push-to-ghcr.outputs.ECS_CLUSTER }}
105114
DOCKER_TAG: ${{ needs.push-to-ghcr.outputs.DOCKER_TAG }}
106-
BUILD_ENGINE_BUILD_TAG: ${{ needs.push-to-ghcr.outputs.BUILD_ENGINE_BUILD_TAG }}
107-
OTEL_BUILD_TAG: ${{ needs.push-to-ghcr.outputs.OTEL_BUILD_TAG }}
115+
BUILD_ENGINE_TAG: ${{ needs.push-to-ghcr.outputs.BUILD_ENGINE_TAG }}
116+
OTEL_TAG: ${{ needs.push-to-ghcr.outputs.OTEL_TAG }}
108117
secrets:
109118
AWS_ACCESS_KEY_ID: ${{ secrets.LU__AWS_ACCESS_KEY_ID }}
110119
AWS_SECRET_ACCESS_KEY: ${{ secrets.LU__AWS_SECRET_ACCESS_KEY }}

.github/workflows/pr.yml

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,6 @@ name: Test and Lint
22

33
on:
44
pull_request:
5-
branches:
6-
- master
7-
- develop
85

96
jobs:
107
checks:

0 commit comments

Comments
 (0)