Skip to content

Commit

Permalink
Merge pull request #7 from software-students-spring2024/Kevin
Browse files Browse the repository at this point in the history
Attempt to deploy to digitalocean CI/CD
  • Loading branch information
Kalados authored Apr 30, 2024
2 parents 881e676 + a365b07 commit 281e7f5
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 28 deletions.
27 changes: 13 additions & 14 deletions .github/workflows/weatherDataCollect.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -22,16 +23,20 @@ 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
echo "One of the secrets is empty!"
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
Expand All @@ -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/[email protected]
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
app_name: weather-data-collect
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}
27 changes: 13 additions & 14 deletions .github/workflows/webApp.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ jobs:
steps:
- name: Checkout Code
uses: actions/checkout@v2

- name: Build and Test Web Application
run: |
cd web-app
Expand All @@ -22,16 +23,20 @@ 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
echo "One of the secrets is empty!"
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
Expand All @@ -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/[email protected]
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
app_name: web-app
token: ${{ secrets.DIGITALOCEAN_ACCESS_TOKEN }}

0 comments on commit 281e7f5

Please sign in to comment.