Skip to content

Commit

Permalink
👷 Added deploy workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
aliberts committed Nov 24, 2023
1 parent 2edaa4f commit d544c0a
Show file tree
Hide file tree
Showing 2 changed files with 53 additions and 0 deletions.
49 changes: 49 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,49 @@
name: Connect to AWS role, build and push to ECR

on:
push:
branches: [ main ]
tags:
- "v*.*.*"
pull_request:
branches: [ main ]

permissions:
id-token: write # This is required for requesting the JWT
contents: read # This is required for actions/checkout
jobs:
ExportDependencies:
runs-on: ubuntu-latest
steps:
- name: Git clone the repository
uses: actions/checkout@v4
- name: Install poetry & poetry export
run: |
pipx install poetry
pipx inject poetry poetry-plugin-export
- name: Cache poetry
uses: actions/setup-python@v4
with:
python-version: '3.10'
cache: 'poetry'
- name: Export requirements.txt
run: poetry export -f requirements.txt --output requirements.txt --without-hashes

AssumeRoleAndPush:
runs-on: ubuntu-latest
steps:
- name: Git clone the repository
uses: actions/checkout@v4
- name: Configure aws credentials
uses: aws-actions/[email protected]
with:
role-to-assume: ${{ IAM_ROLE_ARN }}
role-session-name: GitHub_to_AWS_via_FederatedOIDC
aws-region: "eu-west-3"
- name: Build, tag, and push image to Amazon ECR
run: |
docker build --platform linux/amd64 -t ${{ ECR_REGISTRY }}/inews:latest .
docker push ${{ ECR_REGISTRY }}/inews:latest
aws lambda update-function-code \
--function-name inews \
--image-uri ${{ ECR_REGISTRY }}/inews:latest > /dev/null
4 changes: 4 additions & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@ repos:
args:
- "--check"
- "--no-update"
- repo: https://github.com/mpalmer/action-validator
rev: v0.5.1
hooks:
- id: action-validator
- repo: https://github.com/Yelp/detect-secrets
rev: v1.4.0
hooks:
Expand Down

0 comments on commit d544c0a

Please sign in to comment.