add tests #2
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Build & Push | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
permissions: | |
id-token: write | |
contents: read | |
env: | |
PROJECT_NAME: copilot | |
PYTHON_VERSION: "3.11.2" | |
jobs: | |
build_and_push: | |
name: Build & Push | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Setup Pritunl Profile and Start VPN Connection | |
uses: nathanielvarona/pritunl-client-github-action@v1 | |
with: | |
profile-file: ${{ secrets.PRITUNL_PROFILE_FILE_PRODUCTION }} | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v4 | |
with: | |
role-to-assume: ${{ vars.AWS_IAM_ROLE }} | |
aws-region: ${{ vars.AWS_REGION }} | |
- name: Login to Amazon ECR | |
id: login-ecr | |
uses: aws-actions/amazon-ecr-login@v2 | |
- name: Build, tag, and push docker image to Amazon ECR | |
env: | |
REGISTRY: ${{ steps.login-ecr.outputs.registry }} | |
REPOSITORY: ${{ env.PROJECT_NAME }} | |
COMMIT_SHA: ${{ github.event_name == 'pull_request' && github.event.pull_request.head.sha || github.sha }} | |
run: | | |
docker build --build-arg GIT_COMMIT=$COMMIT_SHA -t $REGISTRY/$REPOSITORY:$COMMIT_SHA --platform linux/amd64 --memory=3072m -f Dockerfile . | |
docker push $REGISTRY/$REPOSITORY:$COMMIT_SHA |