1+ name : Deployment pipeline
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+ pull_request :
8+ branches : [main]
9+ types : [opened, synchronize]
10+
11+ jobs :
12+ simple_deployment_pipeline :
13+ runs-on : ubuntu-latest
14+ steps :
15+ - uses : actions/checkout@v4
16+ - uses : actions/setup-node@v4
17+ with :
18+ node-version : ' 20'
19+
20+ - name : Install and lint backend
21+ run : |
22+ npm install
23+ npm run lint
24+ working-directory : phonebook-backend
25+
26+ - name : Install, lint and build frontend
27+ run : |
28+ npm install
29+ npm run lint
30+ npm run build
31+ working-directory : phonebook-frontend
32+
33+ - name : Notify success
34+ uses : rjstone/discord-webhook-notify@v2
35+ if : success()
36+ with :
37+ webhookUrl : ${{ secrets.DISCORD_WEBHOOK }}
38+ severity : info
39+ details : A new version has been released
40+ title : ${{ github.repository }}
41+ description : ${{ github.event.head_commit.author.username }} - https://github.com/${{ github.repository }}/commit/${{ github.sha }}
42+
43+ - name : Notify failure
44+ uses : rjstone/discord-webhook-notify@v2
45+ if : failure()
46+ with :
47+ webhookUrl : ${{ secrets.DISCORD_WEBHOOK }}
48+ severity : error
49+ details : Build failed
50+ title : ${{ github.repository }}
51+ description : ${{ github.event.head_commit.author.username }} - https://github.com/${{ github.repository }}/commit/${{ github.sha }}
52+
53+ - name : Deploy app
54+ uses : sws2apps/render-deployment@v1.8.0
55+ if : github.event_name == 'push' && !contains(github.event.head_commit.message, '#skip')
56+ with :
57+ serviceId : ${{ secrets.RENDER_SERVICE_ID }}
58+ apiKey : ${{ secrets.RENDER_API_KEY }}
59+ multipleDeployment : false
60+
61+ tag_release :
62+ needs : [simple_deployment_pipeline]
63+ runs-on : ubuntu-latest
64+ if : |
65+ github.event_name == 'push' && !contains(github.event.head_commit.message, '#skip')
66+ steps :
67+ - uses : actions/checkout@v4
68+ - name : Bump version and push tag
69+ uses : anothrNick/github-tag-action@1.73.0
70+ env :
71+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
0 commit comments