-
-
Notifications
You must be signed in to change notification settings - Fork 757
147 lines (128 loc) · 4.78 KB
/
push.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
##############################################################################
##############################################################################
#
# NOTE!
#
# Please read the README.md file in this directory that defines what should
# be placed in this file
#
##############################################################################
##############################################################################
name: push workflow
on:
push:
branches:
- '**'
env:
CODECOV_UNIQUE_NAME: CODECOV_UNIQUE_NAME-${{ github.run_id }}-${{ github.run_number }}
jobs:
Code-Coverage:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
- name: Cache node modules
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-code-coverage-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-code-coverage-${{ env.cache-name }}-
${{ runner.os }}-code-coverage-
${{ runner.os }}-
- if: ${{ steps.cache-npm.outputs.cache-hit != 'true' }}
name: List the state of node modules
run: npm install --legacy-peer-deps
- run: npm run test -- --watchAll=false --coverage
- name: Present and upload coverage to Codecov as ${{env.CODECOV_UNIQUE_NAME}}
uses: codecov/codecov-action@v3
with:
verbose: true
fail_ci_if_error: false
name: '${{env.CODECOV_UNIQUE_NAME}}'
Generate-Documentation:
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/automated-docs'
steps:
- name: Checkout the Repository
uses: actions/checkout@v3
- name: Restore node_modules from cache
id: cache-npm
uses: actions/cache@v3
env:
cache-name: cache-node-modules
with:
path: |
~/.npm
node_modules
key: ${{ runner.os }}-generate-docs-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-generate-docs-${{ env.cache-name }}-
${{ runner.os }}-generate-docs-
${{ runner.os }}-
- name: Install dependencies
run: npm install --legacy-peer-deps
- name: Install TypeScript Globally and add GraphQL tag
run: yarn global add typescript
- run: yarn add graphql-tag
- name: Update Dependencies
run: yarn upgrade
- name: Generate Documentation of Markdown pages
run: |
yarn global add typedoc
yarn add typedoc-plugin-markdown
yarn typedoc --entryPoints src/components src/screens --out talawa-admin-docs --plugin typedoc-plugin-markdown --theme markdown --entryPointStrategy expand --exclude "**/*.test.ts" --exclude "**/*.css"
- name: Checking doc updated
id: DocUpdated
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "updateDoc=true" >> $GITHUB_OUTPUT
echo -e "Documentation has been updated!!"
else
Green='0;32'
NoColor='\033[0m'
echo -e "${Green}No documentation updated${NoColor}"
fi
- name: Set env variables
if: steps.DocUpdated.outputs.updateDoc
run: |
echo "commit_id=$(echo $(git rev-parse HEAD))" >> $GITHUB_ENV
echo "email=$(echo $(git log --pretty=format:"%ae" $commit_id))" >> $GITHUB_ENV
- name: Update Doc
if: steps.DocUpdated.outputs.updateDoc
run: |
Green='0;32'
NoColor='\033[0m'
git config --global user.name "${{github.actor}}"
git config --global user.email "${{env.email}}"
git add .
git commit -m "Update documentation"
git push
echo -e "🚀${Green} Hurrah! doc updated${NoColor}"
- name: Create Documentation Artifact
uses: actions/upload-artifact@v2
with:
name: documentation-admin
path: talawa-admin-docs
Copy-docs-to-talawa-docs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: dmnemec/[email protected]
env:
API_TOKEN_GITHUB: ${{ secrets.TALAWA_DOCS_SYNC_NEW }}
with:
source_file: 'talawa-admin-docs/'
destination_repo: 'PalisadoesFoundation/talawa-docs'
destination_branch: 'develop'
destination_folder: 'docs/'
user_email: '${{env.email}}'
user_name: '${{github.actor}}'
commit_message: 'Talawa Admin docs updated'