diff --git a/.github/workflows/build_publish.yml b/.github/workflows/build_publish.yml new file mode 100644 index 0000000..952a4e8 --- /dev/null +++ b/.github/workflows/build_publish.yml @@ -0,0 +1,42 @@ +name: Run build and push image to registry + +on: + workflow_call: + inputs: + APPLICATION: + required: true + type: string + secrets: + AWS_ACCESS_KEY_ID: + required: true + AWS_SECRET_ACCESS_KEY: + required: true + AWS_REGION: + required: true + +jobs: + build_and_publish: + runs-on: ubuntu-latest + steps: + - name: Clone repository + uses: actions/checkout@v2 + - name: Get commit SHA + uses: benjlevesque/short-sha@v1.2 + with: + length: 7 + - name: Configure AWS credentials + uses: aws-actions/configure-aws-credentials@v1 + with: + aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + aws-region: ${{ secrets.AWS_REGION }} + - name: Login to Amazon ECR + id: login-ecr + uses: aws-actions/amazon-ecr-login@v1 + - name: Build and push + id: docker_build + uses: docker/build-push-action@v2 + with: + push: true + tags: | + ${{ steps.login-ecr.outputs.registry }}/${{ inputs.APPLICATION }}:${{ env.SHA }} \ No newline at end of file diff --git a/.github/workflows/deploy_development.yml b/.github/workflows/deploy_development.yml new file mode 100644 index 0000000..466200d --- /dev/null +++ b/.github/workflows/deploy_development.yml @@ -0,0 +1,16 @@ +name: deploy_development +on: + push: + branches: + # Change this to your branch to deploy your changes to Fargate + - buid-pipeline-setup + +jobs: + build_publish_development: + uses: ./.github/workflows/build_publish.yml + with: + APPLICATION: sesar-rest-api + secrets: + AWS_ACCESS_KEY_ID: ${{ secrets.SESAR_AWS_ACCESS_KEY_ID }} + AWS_SECRET_ACCESS_KEY: ${{ secrets.SESAR_AWS_SECRET_ACCESS_KEY }} + AWS_REGION: ${{ secrets.SESAR_AWS_REGION }} \ No newline at end of file