generated from nyu-software-engineering/final-project
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #7 from software-students-spring2024/Kevin
Attempt to deploy to digitalocean CI/CD
- Loading branch information
Showing
2 changed files
with
26 additions
and
28 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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,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 | ||
|
@@ -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 }} |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -12,6 +12,7 @@ jobs: | |
steps: | ||
- name: Checkout Code | ||
uses: actions/checkout@v2 | ||
|
||
- name: Build and Test Web Application | ||
run: | | ||
cd web-app | ||
|
@@ -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 | ||
|
@@ -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 }} |