feat: add heroku login to workflow #3
Workflow file for this run
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: CI/CD Pipeline | |
on: | |
push: | |
branches: | |
- deploy # Adjust to your primary branch | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js for Frontend | |
uses: actions/setup-node@v2 | |
with: | |
node-version: '20.17.0' # Specify your Node.js version | |
- name: Install Frontend Dependencies | |
run: | | |
cd frontend | |
npm install | |
- name: Build Frontend | |
run: | | |
cd frontend | |
npm run build # Adjust if necessary | |
# - name: Set up Java for Backend | |
# uses: actions/setup-java@v2 | |
# with: | |
# java-version: '22.0.2' # Specify your Java version | |
# - name: Build Backend | |
# run: | | |
# cd backend | |
# mvn package # Use ./gradlew build for Gradle | |
deploy: | |
runs-on: ubuntu-latest | |
needs: build # Ensure build job completes before deploying | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Configure Git | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "GitHub Action" | |
- name: Deploy Frontend to Heroku | |
env: | |
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
run: | | |
cd frontend | |
heroku login -i # Login to Heroku using the API key | |
heroku git:remote -a jetedge-test | |
git add . # You might need to add files to deploy | |
git commit -m "Deploying Frontend" || echo "No changes to commit" | |
git push heroku main --force # Ensure you're pushing to the correct branch | |
# - name: Deploy Backend to Heroku | |
# env: | |
# HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }} | |
# run: | | |
# cd backend | |
# git init | |
# heroku git:remote -a ${{ secrets.HEROKU_BACKEND_APP_NAME }} | |
# git add . | |
# git commit -m "Deploying Backend" || echo "No changes to commit" | |
# git push heroku main --force # Use --force for initial deployment |