-
Notifications
You must be signed in to change notification settings - Fork 11
82 lines (66 loc) · 2.24 KB
/
protos.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
name: Overwrite Proto Directory
on:
push:
branches: [ "main" ]
jobs:
copy-proto:
runs-on: ubuntu-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v3
- name: Run Bash Script to Overwrite Proto Directory
run: |
#!/bin/bash
REPO_URL="https://github.com/Permify/permify.git"
TEMP_DIR="temp_dir"
TARGET_DIR="proto"
# Clone the repository to a temporary directory
git clone --depth=1 $REPO_URL $TEMP_DIR
# Check if the clone was successful
if [ $? -ne 0 ]; then
echo "Failed to clone repository."
exit 1
fi
# Remove the existing proto directory if it exists
if [ -d "$TARGET_DIR" ]; then
rm -rf $TARGET_DIR
fi
# Create the target directory and copy the specific directory to the desired location
mkdir -p $TARGET_DIR
cp -r $TEMP_DIR/proto/* $TARGET_DIR
# Check if the copy was successful
if [ $? -ne 0 ]; then
echo "Failed to copy the directory."
# Clean up the temporary repository directory
rm -rf $TEMP_DIR
exit 1
fi
# Clean up the temporary repository directory
rm -rf $TEMP_DIR
echo "Successfully copied the proto directory to $TARGET_DIR."
- name: Install Node.js and Dependencies
uses: actions/setup-node@v3
with:
node-version: '18'
- name: Install Buf
run: |
# Download and install buf
wget https://github.com/bufbuild/buf/releases/download/v1.7.0/buf-Linux-x86_64 -O /usr/local/bin/buf
chmod +x /usr/local/bin/buf
buf --version
- name: Generate Code with Buf
run: |
# Navigate to the proto directory and run buf generate
npm install ts-proto
buf generate
- name: Add and Commit Changes
run: |
git config --global user.name 'GitHub Actions Bot'
git config --global user.email '<>'
git add src/grpc/generated
git commit -m "Update generated sdk directory with latest changes"
- name: Push Changes
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git push origin main