-
Notifications
You must be signed in to change notification settings - Fork 0
44 lines (36 loc) · 1.12 KB
/
deploy.yml
File metadata and controls
44 lines (36 loc) · 1.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
name: Deploy Project
on:
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
env:
# SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }}
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} # auto-generated
HEROKU_KEY: ${{ secrets.HEROKU_API_KEY }}
HEROKU_EMAIL: ${{ secrets.HEROKU_EMAIL }}
HEROKU_APP_NAME: ${{ secrets.HEROKU_APP_NAME }}
steps:
# checkout repository code
- uses: actions/checkout@v1
# uncomment for assignment 2-4
# - name: SonarCloud Scan
# uses: sonarsource/sonarcloud-github-action@master
# create .netrc file for heroku authentication
# https://devcenter.heroku.com/articles/authentication
- run: |+
cat >~/.netrc <<EOF
machine api.heroku.com
login $HEROKU_EMAIL
password $HEROKU_KEY
machine git.heroku.com
login $HEROKU_EMAIL
password $HEROKU_KEY
EOF
# login with .netrc file
- run: heroku login
# deploy code
- run: heroku git:remote -a $HEROKU_APP_NAME
- run: git push heroku HEAD:refs/heads/main