Skip to content

Commit 063a3a2

Browse files
committed
Add Heroku deployment
1 parent 7ae67ec commit 063a3a2

3 files changed

Lines changed: 25 additions & 2 deletions

File tree

.github/workflows/main.yml

Lines changed: 14 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -33,4 +33,17 @@ jobs:
3333
OCTOKIT_TOKEN: ${{ secrets.OCTOKIT_TOKEN }}
3434
AUTH_CLIENT_ID: ${{ secrets.AUTH_CLIENT_ID }}
3535
AUTH_CLIENT_SECRET: ${{ secrets.AUTH_CLIENT_SECRET }}
36-
run: npm test
36+
run: npm test
37+
38+
deploy:
39+
40+
runs-on: ubuntu-latest
41+
needs: [build]
42+
steps:
43+
- uses: actions/checkout@v3
44+
- name: Deploy to Heroku
45+
uses: AkhileshNS/heroku-deploy@v3.12.12
46+
with:
47+
heroku_api_key: ${{ secrets.HEROKU_API_KEY }}
48+
heroku_email: "yurii.pakhota@sigma.software"
49+
heroku_app_name: "pet-github-react-app"

Procfile

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
web: npm start

src/lib/config.ts

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,8 +34,17 @@ function getConfig(): Config {
3434
});
3535
return {
3636
...envConfig.parsed,
37-
PORT: envConfig.parsed?.PORT ? parseInt(envConfig?.parsed?.PORT) : 8080,
37+
PORT: getPort(),
3838
} as Config;
3939
}
4040

41+
function getPort(): number {
42+
if (envConfig.parsed?.PORT) {
43+
return parseInt(envConfig.parsed.PORT);
44+
} else if (process.env.PORT) {
45+
return parseInt(process.env.PORT);
46+
}
47+
return 8080;
48+
}
49+
4150
export const config: Config = getConfig();

0 commit comments

Comments
 (0)