Skip to content

Commit

Permalink
testing new ci/cd workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
digorgonzola committed Feb 27, 2024
1 parent 998454f commit 835a38a
Show file tree
Hide file tree
Showing 11 changed files with 294 additions and 196 deletions.
6 changes: 6 additions & 0 deletions .github/environment/central.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
AWS_REGION=ap-southeast-2
AWS_ROLE_ARN=arn:aws:iam::851725428481:role/AodnGitHubActionsRole
CODEARTIFACT_DOMAIN=central-aodn-org-au
CODEARTIFACT_REPO=maven-aodn-store
ECR_REGISTRY=851725428481.dkr.ecr.ap-southeast-2.amazonaws.com
ECR_REPOSITORY=sample-django-app
2 changes: 2 additions & 0 deletions .github/environment/edge.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
AWS_REGION=ap-southeast-2
AWS_ROLE_ARN=arn:aws:iam::704910415367:role/AodnGitHubActionsRole
3 changes: 1 addition & 2 deletions .github/environment/production.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
AWS_REGION=ap-southeast-2
ECR_REGISTRY=450356697252.dkr.ecr.ap-southeast-2.amazonaws.com
ECR_REPOSITORY=api
AWS_ROLE_ARN=arn:aws:iam::211125304466:role/AodnGitHubActionsRole
3 changes: 1 addition & 2 deletions .github/environment/staging.env
Original file line number Diff line number Diff line change
@@ -1,3 +1,2 @@
AWS_REGION=ap-southeast-2
ECR_REGISTRY=450356697252.dkr.ecr.ap-southeast-2.amazonaws.com
ECR_REPOSITORY=api
AWS_ROLE_ARN=arn:aws:iam::905418367757:role/AodnGitHubActionsRole
92 changes: 0 additions & 92 deletions .github/workflows/build-production.yml

This file was deleted.

98 changes: 0 additions & 98 deletions .github/workflows/build-staging.yml

This file was deleted.

75 changes: 75 additions & 0 deletions .github/workflows/build_deploy_edge.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
name: Build/Deploy Edge

on:
push:
branches:
- main
paths-ignore:
- '**/*.md'
- '.github/environment/**'

permissions:
id-token: write
contents: read

jobs:
build_push:
runs-on: ubuntu-latest
environment: central
outputs:
digest: ${{ steps.build_and_push.outputs.digest }}
steps:
- name: Checkout
uses: actions/checkout@v4

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Set up JDK 17
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
cache: 'maven'
server-id: 'codeartifact'
server-password: 'CODEARTIFACT_AUTH_TOKEN'

- name: Configure AWS Credentials
id: aws_auth
uses: aws-actions/configure-aws-credentials@v4
with:
audience: sts.amazonaws.com
aws-region: ${{ vars.AWS_REGION }}
role-to-assume: ${{ vars.AWS_ROLE_ARN }}

- name: Build with Maven
run: mvn -B verify --file pom.xml

- name: Login to ECR
uses: docker/login-action@v3
with:
registry: ${{ vars.ECR_REGISTRY }}

- name: Build and Push Docker Image
id: build_and_push
uses: docker/build-push-action@v5
with:
context: .
# Only building for AMD64 for now
# platforms: linux/amd64,linux/arm64
push: true
tags: |
${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:${{ github.sha }}
${{ vars.ECR_REGISTRY }}/${{ vars.ECR_REPOSITORY }}:latest
trigger_edge_deploy:
needs: [build_push]
uses: ./.github/workflows/trigger_deploy.yml
with:
app_name: sample-django-app
environment: edge
digest: ${{ needs.build_push.outputs.digest }}
secrets: inherit
2 changes: 1 addition & 1 deletion .github/workflows/pre-commit.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
name: Pre-commit
name: Run Pre-commit Checks

on:
pull_request:
Expand Down
Loading

0 comments on commit 835a38a

Please sign in to comment.