Continuous Delivery #72
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: Continuous Delivery | |
on: | |
schedule: | |
- cron: "0 3 * * 2,4" | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
AWS_DEFAULT_REGION: ${{ secrets.AWS_DEFAULT_REGION }} | |
AWS_ENVIRONMENT_NAME: ${{ secrets.AWS_ENVIRONMENT_NAME }} | |
AWS_APPLICATION_NAME: ${{ secrets.AWS_APPLICATION_NAME }} | |
steps: | |
- uses: actions/checkout@v2 | |
- name: Install Python 3.9 | |
uses: actions/setup-python@v2 | |
with: | |
python-version: 3.9 | |
- name: Install Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: 1.18.0 | |
- name: Install Dependencies | |
run: go mod download | |
- name: Build application | |
run: go build -o api | |
- name: Install EB CLI using pip | |
run: | | |
python -m pip install --upgrade pip | |
pip install awsebcli | |
- name: Initialize EB Environment | |
run: (echo "2"; echo "n") | eb init -r ${{ env.AWS_DEFAULT_REGION }} ${{ env.AWS_APPLICATION_NAME }} | |
- name: Set EB Environment | |
run: eb use ${{ env.AWS_ENVIRONMENT_NAME }} -r ${{ env.AWS_DEFAULT_REGION }} | |
- name: Deploy to EB | |
run: | | |
if eb deploy; then | |
echo "Deployment succeeded✅" | |
else | |
echo "Deployment failed❌" | |
exit 1 | |
fi |