diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..f1d0f40 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1 @@ +* @Evanjt1 @jhebb @aflesher @sandbender diff --git a/.github/actions/action.yml b/.github/actions/action.yml new file mode 100644 index 0000000..3bd174a --- /dev/null +++ b/.github/actions/action.yml @@ -0,0 +1,42 @@ +name: build-publish-image +description: Build and publish Docker image to ECR +inputs: + repository: + description: 'ECR repository name' + required: true + repo_token: + description: 'Github token' + required: true + dockerfile: + description: 'Dockerfile file name' + required: true +runs: + using: 'composite' + steps: + - name: Checkout Repo + uses: actions/checkout@v3 + + - name: Configure AWS Credentials + uses: aws-actions/configure-aws-credentials@v4 + with: + role-to-assume: arn:aws:iam::559476808817:role/GithubActionsECRRole + aws-region: us-east-1 + + - name: Login to AWS ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v2 + + - name: Build, tag, and push image to AWS ECR + shell: bash + env: + GITHUB_TOKEN: ${{ inputs.repo_token }} + REGISTRY: ${{ steps.login-ecr.outputs.registry }} + REPOSITORY: ${{ inputs.repository }} + IMAGE_TAG: ${{ github.run_number }} + DOCKER_FILE: ${{ inputs.dockerfile }} + run: | + docker build -f ${DOCKER_FILE} --build-arg GITHUB_TOKEN="${GITHUB_TOKEN}" -t $REGISTRY/$REPOSITORY:$IMAGE_TAG . + docker tag $REGISTRY/$REPOSITORY:$IMAGE_TAG $REGISTRY/$REPOSITORY:latest + echo "Pushing images to ECR..." + docker push $REGISTRY/$REPOSITORY:$IMAGE_TAG + docker push $REGISTRY/$REPOSITORY:latest \ No newline at end of file diff --git a/.github/workflows/build-publish-image.yml b/.github/workflows/build-publish-image.yml new file mode 100644 index 0000000..3fd4e51 --- /dev/null +++ b/.github/workflows/build-publish-image.yml @@ -0,0 +1,24 @@ +name: build-images +run-name: Build client-as image and push to ECR +on: + workflow_dispatch: + push: + branches: + - main + +jobs: + build: + name: Build main image and push to ECR + runs-on: ubuntu-latest + permissions: + id-token: write + contents: read + packages: read + steps: + - uses: actions/checkout@v2 + - uses: ./.github/actions/build-publish-image + with: + repository: client-as + repo_token: ${{ secrets.TP_BUILDER_REPO_TOKEN }} + dockerfile: Dockerfile +