-
Notifications
You must be signed in to change notification settings - Fork 26
99 lines (85 loc) · 2.68 KB
/
makefile.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
name: Deploy Proto & NPM publish
on:
pull_request_target:
types: [opened, edited, synchronize]
branches: [ master ]
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_AUTH_TOKEN }}
NPM_VERSION: patch
permissions: read-all
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout source repository
uses: actions/checkout@v3.0.0
with:
ref: master
repository: sge-network/sge
path: sge
- name: Checkout destination repository
uses: actions/checkout@v3.0.0
with:
ref: master
repository: ${{ secrets.ST_REPO }}/sgejs
path: sgejs
token: ${{ secrets.ST_TOKEN }}
- name: Copy Proto Files
run: |
rm -rf sgejs/proto/sge
cp -r sge/proto/sgenetwork sgejs/proto
git -C sgejs add -u .
git -C sgejs status
git -C sgejs config user.email "action@github.com"
git -C sgejs config user.name "GitHub Action"
git -C sgejs commit --allow-empty -am "Proto Deployment [skip ci]"
- name: Npm Install
run: |
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > sgejs/.npmrc
npm install --prefix sgejs
git -C sgejs checkout .
git -C sgejs pull
- name: Delete src/codegen and types
run: |
rm -rf sgejs/src/codegen
rm -rf sgejs/types
- name: Npm Run Codegen
run: |
npm run codegen --prefix sgejs
- name: Commit changes
run: |
git -C sgejs add .
git -C sgejs config user.email "action@github.com"
git -C sgejs config user.name "GitHub Action"
git -C sgejs commit --allow-empty -am "Codegen Deployment [skip ci]"
- name: Determine NPM version
env:
PR_TITLE: ${{ github.event.pull_request.title }}
run: |
cd sgejs
if [[ "$PR_TITLE" == *"major"* ]]; then
echo "NPM_VERSION=major" >> $GITHUB_ENV
elif [[ "$PR_TITLE" == *"minor"* ]]; then
echo "NPM_VERSION=minor" >> $GITHUB_ENV
elif [[ "$PR_TITLE" == *"patch"* ]]; then
echo "NPM_VERSION=patch" >> $GITHUB_ENV
fi
- name: Bump NPM version
run: |
cd sgejs
git status
if [ "${{ env.NPM_VERSION }}" == "major" ]; then
npm version major
elif [ "${{ env.NPM_VERSION }}" == "minor" ]; then
npm version minor
elif [ "${{ env.NPM_VERSION }}" == "patch" ]; then
npm version patch
fi
git status
- name: Push sgejs
run: git -C sgejs push
- name: Publish NPM Package
run: |
echo "//registry.npmjs.org/:_authToken=$NODE_AUTH_TOKEN" > sgejs/.npmrc
cd sgejs
npm publish --access=public --force