Skip to content

Commit

Permalink
updated image build pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
kferrone committed Oct 23, 2023
1 parent adf1a92 commit 8f643a9
Show file tree
Hide file tree
Showing 4 changed files with 1,029 additions and 818 deletions.
48 changes: 17 additions & 31 deletions .github/workflows/image.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -6,44 +6,30 @@ on:
- main
tags:
- v*
workflow_dispatch: {}

env:
duplo_host: "{{ env.DUPLO_HOST }}}}"
duplo_token: "${{ secrets.DUPLO_TOKEN }}"
SERVICE_NAME: hello-duplo
TENANT_NAME: github-example
DUPLO_HOST: ${{ vars.DUPLO_HOST }}
DUPLO_TENANT: ${{ vars.DUPLO_TENANT }}
DUPLO_TOKEN: "${{ secrets.DUPLO_TOKEN }}"

# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
build:
build_image:
name: Build and Push Image
runs-on: ubuntu-latest
env:
AWS_DEFAULT_REGION: us-east-1
steps:
- name: Checkout
uses: actions/checkout@v3

# Set up for docker build
- name: Get AWS credentials
uses: duplocloud/ghactions-aws-jit@master
with:
tenant: $TENANT_NAME

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
- name: Checkout code
uses: actions/checkout@v3

- name: Duplo Setup
uses: duplocloud/actions/setup@main

# Build and push the docker image
- name: Docker Build and Push
uses: docker/build-push-action@v2
env:
IMAGE: ${{ steps.login-ecr.outputs.registry }}/${{ env.SERVICE_NAME }}
with:
context: .
push: true
tags: |
${{ env.IMAGE }}:${{ github.sha }}
${{ env.IMAGE }}:latest
# This part is important - it will be used by the deploy job
outputs:
image: "${{ steps.login-ecr.outputs.registry }}/${{ env.SERVICE_NAME }}:${{ github.sha }}"
- name: Build and Push Docker Image
uses: duplocloud/actions/build-image@main
with:
platforms: linux/amd64,linux/arm64
push: false
19 changes: 0 additions & 19 deletions .github/workflows/push.yml

This file was deleted.

34 changes: 34 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
name: Test
run-name: Example Test Flow
on: [push]
jobs:
build_test:
runs-on: ubuntu-latest
steps:

- name: Checkout Code
uses: actions/checkout@v3

- name: Setup Node
uses: actions/setup-node@v3
with:
node-version: 19
cache: npm

- name: Install
run: npm ci

- name: Build
run: npm build:ci

- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: build
path: ./dist/

- name: Test
run: npm test

- name: Audit
run: npm audit
Loading

0 comments on commit 8f643a9

Please sign in to comment.