From d7d466cc6c47615b5cdfec8d9a7dfa11f2f3ff2f Mon Sep 17 00:00:00 2001 From: f-bguiga <136806243+f-bguiga@users.noreply.github.com> Date: Wed, 31 Jan 2024 11:02:28 +0100 Subject: [PATCH] Create main.yml --- .github/workflows/main.yml | 39 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..3ee52e1 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,39 @@ +name: Test & Deploy +on: + push: + branches: + - master +jobs: + test-and-deploy: + runs-on: ubuntu-latest + steps: + - name: Checkout Latest Repo + uses: actions/checkout@master + + # Zip Dockerfile for upload + - name: Generate Deployment Package + run: zip -r deploy.zip * -x "**node_modules**" + + - name: Get timestamp + uses: gerred/actions/current-time@master + id: current-time + + - name: Run string replace + uses: frabert/replace-string-action@master + id: format-time + with: + pattern: '[:\.]+' + string: "${{ steps.current-time.outputs.time }}" + replace-with: '-' + flags: 'g' + + - name: Deploy to EB + uses: einaregilsson/beanstalk-deploy@v14 + with: + aws_access_key: ${{ secrets.AWS_ACCESS_KEY_ID }} + aws_secret_key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} + application_name: docker-app + environment_name: Docker-app-env + version_label: "my-first-docker-deployment-${{ steps.format-time.outputs.replaced }}" + region: us-east-1 + deployment_package: deploy.zip