-
Notifications
You must be signed in to change notification settings - Fork 0
130 lines (126 loc) · 3.9 KB
/
continuous-deployment.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
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
name: Continuous Deployment
on:
workflow_dispatch:
inputs: {}
push:
branches:
- main
paths:
- '.github/workflows/continuous-deployment.yml'
- 'README.md'
- 'codegen.yml'
- 'package.json'
jobs:
GenerateTypings:
name: Generate TypeScript, and SDL type information
runs-on: ubuntu-latest
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Use Node.js 16
uses: actions/setup-node@v2
with:
node-version: 16
- name: Restore CI Cache
uses: actions/[email protected]
with:
path: node_modules
key: ${{ runner.os }}-16-${{ hashFiles('**/yarn.lock') }}
- name: Restore CI Cache
uses: actions/[email protected]
id: cache-restore
with:
path: node_modules
key: ${{ runner.os }}-16-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies if Cache Miss
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: yarn --frozen-lockfile
- name: Generate GraphQL Schema code
run: |
yarn codegen
- name: Upload typescript bundle to artifacts
uses: actions/upload-artifact@v2
with:
name: typescript_bundle
path: generated/ts/
if-no-files-found: error
GithubPublish:
name: Publishing release to Github
runs-on: ubuntu-latest
needs: [GenerateTypings]
steps:
- name: Checkout Project
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Use Node.js v16
uses: actions/setup-node@v2
with:
node-version: 16
- name: Restore CI Cache
uses: actions/[email protected]
id: cache-restore
with:
path: node_modules
key: ${{ runner.os }}-16-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies if Cache Miss
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: yarn --frozen-lockfile
- name: Configure Git
run: |
git config --local user.email "41898282+github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
- name: Bump semver
run: yarn sversion
- name: Store bumped package.json
uses: actions/upload-artifact@v2
with:
name: package_bundle
path: package.json
if-no-files-found: error
- name: Store bumped changelog.md
uses: actions/upload-artifact@v2
with:
name: changelog_bundle
path: CHANGELOG.md
if-no-files-found: error
- name: Push changes
run: git push --follow-tags origin main
NPMPublish:
name: Publishing release to NPM
runs-on: ubuntu-latest
needs: [GithubPublish]
steps:
- name: Checkout Project
uses: actions/checkout@v2
- name: Setup Node for publishing to Github
uses: actions/setup-node@v2
with:
node-version: 16
registry-url: 'https://registry.npmjs.org'
- name: Download generated typings artifact
uses: actions/download-artifact@v2
with:
name: typescript_bundle
path: generated/ts/
- name: Download stored package.json
uses: actions/download-artifact@v2
with:
name: package_bundle
- name: Download stored changelog.md
uses: actions/download-artifact@v2
with:
name: changelog_bundle
- name: Restore CI Cache
uses: actions/[email protected]
id: cache-restore
with:
path: node_modules
key: ${{ runner.os }}-16-${{ hashFiles('**/yarn.lock') }}
- name: Install Dependencies if Cache Miss
if: ${{ !steps.cache-restore.outputs.cache-hit }}
run: yarn --frozen-lockfile
- name: Publish to Github
run: npm publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}