@@ -11,102 +11,107 @@ on:
11
11
required : false
12
12
type : boolean
13
13
default : false
14
+ dry-run :
15
+ description : ' Is dry run?'
16
+ required : false
17
+ type : boolean
18
+ default : false
14
19
jobs :
15
- # build-and-test:
16
- # name: "Build and test"
17
- # runs-on: ubuntu-latest
18
- # permissions:
19
- # contents: "read"
20
- # actions: "read"
21
- # steps:
22
- # - uses: actions/checkout@v4
23
- # with:
24
- # fetch-depth: 0
25
- # - name: Npm install
26
- # uses: ./.github/actions
27
- # - name: Get git hash
28
- # run: |
29
- # COMMIT=$(git show-ref --tags --hash | tail -n 1)
30
- # echo "NX_BASE=$(echo ${COMMIT})" >> $GITHUB_ENV
31
- # - name: Set GIST_SECRET to env
32
- # run: |
33
- # echo "GIST_SECRET=${{ secrets.GIST_SECRET }}" >> $GITHUB_ENV
34
- # echo "GIST_ID=${{ secrets.GIST_ID }}" >> $GITHUB_ENV
35
- # - name: Restore cached .nx
36
- # id: cache-nx-restore
37
- # uses: actions/cache/restore@v4
38
- # with:
39
- # path: |
40
- # .nx
41
- # key: ${{ runner.os }}-nx-master
42
- # - name: Test
43
- # env:
44
- # NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
45
- # run: npx nx affected -t test --parallel=3 --exclude='json-api-front,json-api-server,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source,type-for-rpc'
46
- # - name: Build
47
- # env:
48
- # NX_REJECT_UNKNOWN_LOCAL_CACHE: 0
49
- # run: npx nx affected -t build --exclude='json-api-front,json-api-server,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source,type-for-rpc'
50
- # - name: Upload test coverage badge
51
- # run: npx nx affected -t upload-badge --exclude='json-api-front,json-api-server,shared-utils,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source,type-for-rpc'
52
- # - name: Save cached .nx
53
- # id: cache-dependencies-save
54
- # uses: actions/cache/save@v4
55
- # with:
56
- # path: |
57
- # .nx
58
- # key: ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
59
- # run-e2e-test:
60
- # runs-on: ubuntu-latest
61
- # name: Try run e2e test
62
- # needs:
63
- # - build-and-test
64
- # services:
65
- # # Label used to access the service container
66
- # postgres:
67
- # # Docker Hub image
68
- # image: postgres
69
- # # Provide the password for postgres
70
- # env:
71
- # POSTGRES_PASSWORD: postgres
72
- # POSTGRES_DB: json-api-db
73
- # # Set health checks to wait until postgres has started
74
- # options: >-
75
- # --health-cmd pg_isready
76
- # --health-interval 10s
77
- # --health-timeout 5s
78
- # --health-retries 5
79
- # ports:
80
- # # Maps tcp port 5432 on service container to the host
81
- # - 5432:5432
82
- # steps:
83
- # - uses: actions/checkout@v4
84
- # with:
85
- # fetch-depth: 0
86
- # - name: Npm install
87
- # uses: ./.github/actions
88
- # - name: Restore cached .nx
89
- # id: cache-nx-restore
90
- # uses: actions/cache/restore@v4
91
- # with:
92
- # path: |
93
- # .nx
94
- # key: ${{ runner.os }}-nx-master
95
- # - run: git branch --track main origin/master
96
- # - run: npm run typeorm migration:run
97
- # - run: npm run seed:run
98
- # - run: npx nx affected -t e2e --parallel=1
99
- # - name: Save cached .nx
100
- # id: cache-dependencies-save
101
- # uses: actions/cache/save@v4
102
- # with:
103
- # path: |
104
- # .nx
105
- # key: ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
20
+ build-and-test :
21
+ name : " Build and test"
22
+ runs-on : ubuntu-latest
23
+ permissions :
24
+ contents : " read"
25
+ actions : " read"
26
+ steps :
27
+ - uses : actions/checkout@v4
28
+ with :
29
+ fetch-depth : 0
30
+ - name : Npm install
31
+ uses : ./.github/actions
32
+ - name : Get git hash
33
+ run : |
34
+ COMMIT=$(git show-ref --tags --hash | tail -n 1)
35
+ echo "NX_BASE=$(echo ${COMMIT})" >> $GITHUB_ENV
36
+ - name : Set GIST_SECRET to env
37
+ run : |
38
+ echo "GIST_SECRET=${{ secrets.GIST_SECRET }}" >> $GITHUB_ENV
39
+ echo "GIST_ID=${{ secrets.GIST_ID }}" >> $GITHUB_ENV
40
+ - name : Restore cached .nx
41
+ id : cache-nx-restore
42
+ uses : actions/cache/restore@v4
43
+ with :
44
+ path : |
45
+ .nx
46
+ key : ${{ runner.os }}-nx-master
47
+ - name : Test
48
+ env :
49
+ NX_REJECT_UNKNOWN_LOCAL_CACHE : 0
50
+ run : npx nx affected -t test --parallel=3 --exclude='json-api-front,json-api-server,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source,type-for-rpc'
51
+ - name : Build
52
+ env :
53
+ NX_REJECT_UNKNOWN_LOCAL_CACHE : 0
54
+ run : npx nx affected -t build --exclude='json-api-front,json-api-server,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source,type-for-rpc'
55
+ - name : Upload test coverage badge
56
+ run : npx nx affected -t upload-badge --exclude='json-api-front,json-api-server,shared-utils,json-api-server-e2e,json-shared-type,database,@nestjs-json-api/source,type-for-rpc'
57
+ - name : Save cached .nx
58
+ id : cache-dependencies-save
59
+ uses : actions/cache/save@v4
60
+ with :
61
+ path : |
62
+ .nx
63
+ key : ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
64
+ run-e2e-test :
65
+ runs-on : ubuntu-latest
66
+ name : Try run e2e test
67
+ needs :
68
+ - build-and-test
69
+ services :
70
+ # Label used to access the service container
71
+ postgres :
72
+ # Docker Hub image
73
+ image : postgres
74
+ # Provide the password for postgres
75
+ env :
76
+ POSTGRES_PASSWORD : postgres
77
+ POSTGRES_DB : json-api-db
78
+ # Set health checks to wait until postgres has started
79
+ options : >-
80
+ --health-cmd pg_isready
81
+ --health-interval 10s
82
+ --health-timeout 5s
83
+ --health-retries 5
84
+ ports :
85
+ # Maps tcp port 5432 on service container to the host
86
+ - 5432:5432
87
+ steps :
88
+ - uses : actions/checkout@v4
89
+ with :
90
+ fetch-depth : 0
91
+ - name : Npm install
92
+ uses : ./.github/actions
93
+ - name : Restore cached .nx
94
+ id : cache-nx-restore
95
+ uses : actions/cache/restore@v4
96
+ with :
97
+ path : |
98
+ .nx
99
+ key : ${{ runner.os }}-nx-master
100
+ - run : git branch --track main origin/master
101
+ - run : npm run typeorm migration:run
102
+ - run : npm run seed:run
103
+ - run : npx nx affected -t e2e --parallel=1
104
+ - name : Save cached .nx
105
+ id : cache-dependencies-save
106
+ uses : actions/cache/save@v4
107
+ with :
108
+ path : |
109
+ .nx
110
+ key : ${{ steps.cache-nx-restore.outputs.cache-primary-key }}
106
111
bump-version :
107
112
name : " Bump version"
108
- # needs:
109
- # - run-e2e-test
113
+ needs :
114
+ - run-e2e-test
110
115
runs-on : ubuntu-latest
111
116
permissions :
112
117
contents : " write"
@@ -125,7 +130,7 @@ jobs:
125
130
run : |
126
131
git config --global user.email "[email protected] "
127
132
git config --global user.name "GitHub Actions"
128
- npx nx release --skip-publish --first-release=${{ github.event.inputs.first-release }} --projects=${{ github.event.inputs.projects }} --dry-run
133
+ npx nx release --skip-publish --first-release=${{ github.event.inputs.first-release }} --projects=${{ github.event.inputs.projects }} --dry-run=${{ github.event.inputs.dry-run }}
129
134
shell : bash
130
135
env :
131
136
NODE_AUTH_TOKEN : ${{ secrets.NPM_ACCESS_TOKEN }}
0 commit comments