Skip to content

Commit

Permalink
Merge pull request #68 from openfido/develop
Browse files Browse the repository at this point in the history
Develop
  • Loading branch information
Thistleman committed May 1, 2024
2 parents c11638c + 3d7a33d commit ad338ab
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 26 deletions.
17 changes: 8 additions & 9 deletions .github/workflows/docker-deploy-prod.yml
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
name: Deploy Production
on:
push:
tags:
- v*.*.*
on:
release:
types: [published]

jobs:
deploy-production:
Expand All @@ -29,7 +28,7 @@ jobs:
sudo chmod o+x /root/
- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -42,15 +41,15 @@ jobs:
run: python -m pip install -r requirements.txt

- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.PROD_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.PROD_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

# uses repository in your authorized registry to push to.
# sign in to your ecr page for a list of all your repositories.
Expand All @@ -66,7 +65,7 @@ jobs:
export DOCKER_BUILDKIT=1
docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
echo "IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV
# needed for the task-definition.json file, update task family here
# can also use the CLI to manually generate the task
Expand All @@ -80,7 +79,7 @@ jobs:
with:
task-definition: task-definition.json
container-name: 'openfido-prod-app-task'
image: ${{ steps.build-image.outputs.image }}
image: ${{ env.IMAGE }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
Expand Down
20 changes: 10 additions & 10 deletions .github/workflows/docker-deploy-stage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,14 +2,14 @@ name: Deploy Staging
on:
push:
branches:
- master
- develop
jobs:
build:
runs-on: ubuntu-latest
environment: Build
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
Expand All @@ -20,7 +20,7 @@ jobs:
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)

- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -38,7 +38,7 @@ jobs:
python3 -m invoke test --junit --enforce-percent 97
- name: Store test results as artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: store test results
path: test-results
Expand All @@ -57,7 +57,7 @@ jobs:
DOCKER_BUILDKIT: "1"
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
Expand All @@ -74,7 +74,7 @@ jobs:
sudo chmod o+x /root/
- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -83,15 +83,15 @@ jobs:
python -m pip install --upgrade pip
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v1
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.STAGE_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.STAGE_SECRET_ACCESS_KEY }}
aws-region: ${{ secrets.AWS_REGION }}

- name: Login to Amazon ECR
id: login-ecr
uses: aws-actions/amazon-ecr-login@v1
uses: aws-actions/amazon-ecr-login@v2

# uses repository in your authorized registry to push to.
# sign in to your ecr page for a list of all your repositories.
Expand All @@ -107,7 +107,7 @@ jobs:
export DOCKER_BUILDKIT=1
docker build --build-arg SSH_PRIVATE_KEY="$(cat ~/.ssh/id_rsa)" -t $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG -f Dockerfile .
docker push $ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG
echo "::set-output name=image::$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG"
echo "IMAGE=$ECR_REGISTRY/$ECR_REPOSITORY:$IMAGE_TAG" >> $GITHUB_ENV
# needed for the task-definition.json file, update task family here
# can also use the CLI to manually generate the task
Expand All @@ -121,7 +121,7 @@ jobs:
with:
task-definition: task-definition.json
container-name: 'openfido-stage-app-task'
image: ${{ steps.build-image.outputs.image }}
image: ${{ env.IMAGE }}

- name: Deploy Amazon ECS task definition
uses: aws-actions/amazon-ecs-deploy-task-definition@v1
Expand Down
13 changes: 7 additions & 6 deletions .github/workflows/test-build.yml
Original file line number Diff line number Diff line change
@@ -1,15 +1,16 @@
name: Test-build
on:
on:
push:
branches-ignore:
- master
branches: [develop,master]
pull_request:
branches: [develop,master]
jobs:
test-build:
runs-on: ubuntu-latest
environment: Build
steps:
- name: Checkout Repository
uses: actions/checkout@v3
uses: actions/checkout@v4

- name: Install SSH key
uses: shimataro/ssh-key-action@v2
Expand All @@ -20,7 +21,7 @@ jobs:
if_key_exists: fail # replace / ignore / fail; optional (defaults to fail)

- name: Install Python
uses: actions/setup-python@v3
uses: actions/setup-python@v4
with:
python-version: 3.8

Expand All @@ -38,7 +39,7 @@ jobs:
python -m invoke test --junit --enforce-percent 97
- name: Store test results as artifacts
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v4
with:
name: store test results
path: test-results
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ RUN apt-get update -qq && apt-get install -y ssh git

# require a private key to access private github repositories
ARG SSH_PRIVATE_KEY
RUN mkdir ~/.ssh/
RUN mkdir -p ~/.ssh/
RUN echo "${SSH_PRIVATE_KEY}" > ~/.ssh/id_rsa
RUN chmod 600 ~/.ssh/id_rsa
RUN touch ~/.ssh/known_hosts
Expand Down

0 comments on commit ad338ab

Please sign in to comment.