generated from nestjs/typescript-starter
-
Notifications
You must be signed in to change notification settings - Fork 80
114 lines (94 loc) · 2.94 KB
/
release.yml
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
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
name: Release
on:
push:
branches:
- master
- main
env:
HEROKU_STAGING_APP_NAME: nestjs-starter-staging
HEROKU_PRODUCTION_APP_NAME: nestjs-starter-production
concurrency:
group: ${{ github.ref }}-release
jobs:
build-and-push-image-to-heroku:
runs-on: ubuntu-latest
timeout-minutes: 10
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
steps:
- uses: actions/checkout@v2
- name: Set up Docker Buildx to be able to use caching
uses: docker/setup-buildx-action@v1
- uses: docker/login-action@v1
with:
registry: registry.heroku.com
username: _
password: ${{ secrets.HEROKU_API_KEY }}
- name: Docker build
uses: docker/build-push-action@v2
with:
push: true
tags: registry.heroku.com/${{ env.HEROKU_STAGING_APP_NAME }}/web,registry.heroku.com/${{ env.HEROKU_PRODUCTION_APP_NAME }}/web
file: Dockerfile.prod
cache-from: type=gha
cache-to: type=gha
deploy-staging:
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.ref == 'refs/heads/master' && github.repository_owner == 'thisismydesign'
needs: [build-and-push-image-to-heroku]
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
steps:
- name: Run release command
run: heroku container:release web -a ${{ env.HEROKU_STAGING_APP_NAME }}
test-e2e-staging:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [deploy-staging]
steps:
- uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@v4
with:
wait-on: 'https://nestjs-starter-staging.herokuapp.com'
wait-on-timeout: 120
config-file: cypress.staging.config.ts
- name: Save Cypress artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-artifacts-staging
path: |
cypress/videos
cypress/screenshots
deploy-production:
runs-on: ubuntu-latest
timeout-minutes: 10
if: github.ref == 'refs/heads/master' && github.repository_owner == 'thisismydesign'
needs: [build-and-push-image-to-heroku, test-e2e-staging]
env:
HEROKU_API_KEY: ${{ secrets.HEROKU_API_KEY }}
steps:
- name: Run release command
run: heroku container:release web -a ${{ env.HEROKU_PRODUCTION_APP_NAME }}
test-e2e-production:
runs-on: ubuntu-latest
timeout-minutes: 10
needs: [deploy-production]
steps:
- uses: actions/checkout@v2
- name: Cypress run
uses: cypress-io/github-action@v4
with:
wait-on: 'https://nestjs-starter-production.herokuapp.com'
wait-on-timeout: 120
config-file: cypress.production.config.ts
- name: Save Cypress artifacts
uses: actions/upload-artifact@v4
if: always()
with:
name: cypress-artifacts-production
path: |
cypress/videos
cypress/screenshots