Skip to content

Commit

Permalink
add port (#78)
Browse files Browse the repository at this point in the history
* add changed angular enviroments and build and serve for production
  • Loading branch information
MocStepan authored May 8, 2024
1 parent b3b6b8e commit ed0556f
Show file tree
Hide file tree
Showing 6 changed files with 34 additions and 16 deletions.
29 changes: 17 additions & 12 deletions .github/workflows/deploy-backend.yml
Original file line number Diff line number Diff line change
@@ -1,22 +1,12 @@
name: Deploy
name: Deploy frontend and backend
run-name: "Run ${{github.run_id}}, triggered by ${{github.actor}}"

on:
workflow_dispatch:
pull_request:
branches:
- main
-
defaults:
run:
working-directory: backend

jobs:
build-deploy:
deploy-backend:
runs-on: ubuntu-latest
defaults:
run:
working-directory: backend
steps:
- uses: actions/checkout@v4
- name: Deploy backend to Heroku
Expand All @@ -29,3 +19,18 @@ jobs:
branch: 'main'
appdir: 'backend'
procfile: 'web: java $JAVA_OPTS -Dserver.port=$PORT -jar build/libs/backend-1.0.0.jar --spring.profiles.active=prod'

deploy-frontend:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Deploy backend to Heroku
uses: akhileshns/[email protected]
with:
heroku_api_key: ${{secrets.HEROKU_API_KEY}}
heroku_app_name: ${{ secrets.HEROKU_FRONTEND_NAME }}
heroku_email: ${{ secrets.HEROKU_EMAIL }}
healthcheck: false
branch: 'main'
appdir: 'frontend'
procfile: 'web: npm build:prod && npm start:prod'
10 changes: 8 additions & 2 deletions frontend/angular.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,13 @@
"maximumError": "4kb"
}
],
"outputHashing": "all"
"outputHashing": "all",
"fileReplacements": [
{
"replace": "src/environments/environment.ts",
"with": "src/environments/environment.production.ts"
}
]
},
"development": {
"optimization": false,
Expand All @@ -67,7 +73,7 @@
"buildTarget": "frontend:build:production"
},
"development": {
"buildTarget": "frontend:build:development",
"buildTarget": "frontend:build:development"
}
},
"defaultConfiguration": "development"
Expand Down
2 changes: 2 additions & 0 deletions frontend/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
"ng": "ng",
"start": "ng serve",
"build": "ng build",
"build:production": "node build.js --configuration production",
"start:production": "node serve.js --configuration production",
"watch": "ng build --watch --configuration development",
"test": "jest --verbose --coverage",
"test:coverage": "jest --coverage",
Expand Down
5 changes: 5 additions & 0 deletions frontend/src/environments/enviroment.production.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
export const environment = {
baseUrl: 'https://moc-backend-weather-app-d8c5764193db.herokuapp.com/',
production: true,
version: '1.0.0'
};
2 changes: 1 addition & 1 deletion frontend/src/environments/environment.development.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const environment = {
baseUrl: 'http://localhost:8080/',
production: false,
version: '0.0.1'
version: '1.0.0'
};
2 changes: 1 addition & 1 deletion frontend/src/environments/environment.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
export const environment = {
baseUrl: '',
production: false,
version: '0.0.1'
version: '1.0.0'
};

0 comments on commit ed0556f

Please sign in to comment.