From d91517ebccb3fc4627c84f64d5dcf819239500ff Mon Sep 17 00:00:00 2001 From: tungkhanhh Date: Sun, 22 Sep 2024 15:09:50 +1000 Subject: [PATCH] feat: add main.yml for CI/CD pipeline --- .github/workflows/main.yml | 57 ++++++++++++++++++++++++++++++++++++++ .gitignore | 14 +++++++++- 2 files changed, 70 insertions(+), 1 deletion(-) create mode 100644 .github/workflows/main.yml diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml new file mode 100644 index 0000000..36039f8 --- /dev/null +++ b/.github/workflows/main.yml @@ -0,0 +1,57 @@ +name: CI/CD Pipeline + +on: + push: + branches: + - develop + +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 + steps: + - uses: actions/checkout@v2 + - uses: akhileshns/heroku-deploy@v3.13.15 + with: + heroku_api_key: ${{secrets.HEROKU_API_KEY}} + heroku_app_name: ${{secrets.HEROKU_FRONTEND_APP_NAME}} + heroku_email: ${{secrets.HEROKU_EMAIL}} + appdir: "frontend" + + # - uses: akhileshns/heroku-deploy@v3.13.15 + # with: + # heroku_api_key: ${{secrets.HEROKU_API_KEY}} + # heroku_app_name: ${{secrets.HEROKU_BACKEND_APP_NAME}} + # heroku_email: ${{secrets.HEROKU_EMAIL}} + # appdir: "backend" \ No newline at end of file diff --git a/.gitignore b/.gitignore index b2561e3..0e47db9 100644 --- a/.gitignore +++ b/.gitignore @@ -1 +1,13 @@ -.env/ \ No newline at end of file +# Editor directories and files +.vscode/* +!.vscode/extensions.json +.idea +.DS_Store +*.suo +*.ntvs* +*.njsproj +*.sln +*.sw? + +# env variables +.env \ No newline at end of file