From a365b07419e1c6007edc6e78aac80c8c4a9ddeff Mon Sep 17 00:00:00 2001 From: Kalados Date: Tue, 30 Apr 2024 16:36:25 -0400 Subject: [PATCH] Attempt to deploy to digitalocean CI/CD --- .github/workflows/weatherDataCollect.yml | 27 ++++++++++++------------ .github/workflows/webApp.yml | 27 ++++++++++++------------ 2 files changed, 26 insertions(+), 28 deletions(-) diff --git a/.github/workflows/weatherDataCollect.yml b/.github/workflows/weatherDataCollect.yml index a387e51..8b2acea 100644 --- a/.github/workflows/weatherDataCollect.yml +++ b/.github/workflows/weatherDataCollect.yml @@ -12,6 +12,7 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v2 + - name: Build and Test Weather Data Collection run: | cd weather-data-collect @@ -22,7 +23,9 @@ jobs: needs: build-and-test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Code + uses: actions/checkout@v2 + - name: Check if secrets are empty run: | if [ -z "${{ secrets.DOCKER_USERNAME }}" ] || [ -z "${{ secrets.DOCKER_PASSWORD }}" ]; then @@ -30,8 +33,10 @@ jobs: else echo "Secrets are not empty." fi + - name: Login to Docker Hub run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + - name: Push Weather Data Collection to Docker Hub run: | cd weather-data-collect @@ -43,17 +48,11 @@ jobs: needs: push-to-docker-hub runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install doctl - uses: digitalocean/action-doctl@v2 + - name: Checkout Code + uses: actions/checkout@v2 + + - name: DigitalOcean App Platform Deployment + uses: digitalocean/app_action@v1.1.5 with: - token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - - name: Log in to DigitalOcean Container Registry - run: doctl registry login --expiry-seconds 600 - - name: Build and Push Fetch Weather Image - run: | - cd weather-data-collect - docker build -t registry.digitalocean.com/cs-474-project-5/weather-data-collect:latest . - docker push registry.digitalocean.com/cs-474-project-5/weather-data-collect:latest - - name: Deploy to App Platform - run: doctl apps create --spec .do/app.yaml \ No newline at end of file + app_name: weather-data-collect + token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/webApp.yml b/.github/workflows/webApp.yml index 970717b..81c2667 100644 --- a/.github/workflows/webApp.yml +++ b/.github/workflows/webApp.yml @@ -12,6 +12,7 @@ jobs: steps: - name: Checkout Code uses: actions/checkout@v2 + - name: Build and Test Web Application run: | cd web-app @@ -22,7 +23,9 @@ jobs: needs: build-and-test runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 + - name: Checkout Code + uses: actions/checkout@v2 + - name: Check if secrets are empty run: | if [ -z "${{ secrets.DOCKER_USERNAME }}" ] || [ -z "${{ secrets.DOCKER_PASSWORD }}" ]; then @@ -30,8 +33,10 @@ jobs: else echo "Secrets are not empty." fi + - name: Login to Docker Hub run: echo "${{ secrets.DOCKER_PASSWORD }}" | docker login -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin + - name: Push Web App to Docker Hub run: | cd web-app @@ -43,17 +48,11 @@ jobs: needs: push-to-docker-hub runs-on: ubuntu-latest steps: - - uses: actions/checkout@v2 - - name: Install doctl - uses: digitalocean/action-doctl@v2 + - name: Checkout Code + uses: actions/checkout@v2 + + - name: DigitalOcean App Platform Deployment + uses: digitalocean/app_action@v1.1.5 with: - token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} - - name: Log in to DigitalOcean Container Registry - run: doctl registry login --expiry-seconds 600 - - name: Build and Push Web App Image - run: | - cd web-app - docker build -t registry.digitalocean.com/cs-474-project-5/web-app:latest . - docker push registry.digitalocean.com/cs-474-project-5/web-app:latest - - name: Deploy to App Platform - run: doctl apps create --spec .do/app.yaml \ No newline at end of file + app_name: web-app + token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }} \ No newline at end of file