-
Notifications
You must be signed in to change notification settings - Fork 16
176 lines (174 loc) · 5.69 KB
/
build.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
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
name: Build
on:
push:
branches:
- sprint
jobs:
unitTests:
if: ${{ false }}
name: Unit Tests
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: sprint
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
- name: Set Gradle User Home
run: export GRADLE_USER_HOME=$(pwd)/.gradle
- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: .gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Cache Gradle Wrapper
uses: actions/cache@v2
with:
path: .gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
buildJar:
# if: ${{ false }}
name: Build JAR
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
with:
submodules: recursive
- name: Pull & update submodules recursively
run: |
git submodule update --init --recursive
git submodule update --recursive --remote
- name: Commit
run: |
git config user.email "[email protected]"
git config user.name "GitHub Actions - update submodules"
git add --all
git commit -m "Update submodules" || echo "No changes to commit"
git push
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: temurin
- name: Set Gradle User Home
run: export GRADLE_USER_HOME=$(pwd)/.gradle
- name: Assemble JAR
run: ./gradlew assemble
- name: Cache Gradle Dependencies
uses: actions/cache@v2
with:
path: .gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: ${{ runner.os }}-gradle
- name: Cache Gradle Wrapper
uses: actions/cache@v2
with:
path: .gradle/wrapper
key: ${{ runner.os }}-gradle-wrapper-${{ hashFiles('**/gradle-wrapper.properties') }}
restore-keys: ${{ runner.os }}-gradle
- name: Upload JAR
uses: actions/upload-artifact@v2
with:
name: open-chain.jar
path: build/libs/*.jar
packageNative:
name: Package Native
runs-on: ubuntu-latest
needs:
- buildJar
env:
INSTALL4J_KEY: ${{ secrets.INSTALL4J_KEY }}
steps:
- name: Checkout code
uses: actions/checkout@v2
- name: Set up JDK 8
uses: actions/setup-java@v2
with:
java-version: 8
distribution: temurin
- name: Install Gettext
run: sudo apt-get -y install gettext
- name: Set Version
run: |
export VERSION=$(echo ${{ github.ref }} | sed -e 's/v//')
echo "VERSION=$VERSION" >> $GITHUB_ENV
- name: Substitute Version in File
run: |
envsubst '${VERSION}' < install4j/multi.install4j > install4j/multi.install4j.new
mv install4j/multi.install4j.new install4j/multi.install4j
- name: Download JAR
uses: actions/download-artifact@master
with:
name: open-chain.jar
path: build/libs/
- name: Run install4j
run: >
docker run --rm -v "$(pwd):/packages" openplatform/install4j:full \
/JRE/install4j7.0.6/bin/install4jc --license=${INSTALL4J_KEY} /packages/install4j/multi.install4j
- name: Upload artifacts
uses: actions/upload-artifact@v2
with:
name: artifacts
path: artifacts/
deploy:
name: Deploy with Volume Deletion
runs-on: ubuntu-latest
needs:
- buildJar
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: sprint
- name: Download JAR
uses: actions/download-artifact@master
with:
name: open-chain.jar
path: build/libs/
- name: Build and push
run: |
docker login -u ${{ secrets.DOCKER_LOGIN }} -p ${{ secrets.DOCKER_PASS }}
docker build -t openplatform/chain-v2:v0.0.1 .
docker push openplatform/chain-v2:v0.0.1
- name: Setup SSH connection
run: |
eval $(ssh-agent -s)
mkdir -p ~/.ssh
chmod 700 ~/.ssh
ssh-keyscan 35.194.84.89 >> ~/.ssh/known_hosts
chmod 644 ~/.ssh/known_hosts
echo "${{ secrets.OPENCHAIN_DEPLOY_KEY }}" | tr -d '\r' > ansible/key.pem
chmod 600 ansible/key.pem
- name: Deploy
uses: docker://openplatform/ansible
with:
entrypoint: bash
args: ansible/deploy.sh
env:
SERVER1: ${{ secrets.SERVER1 }}
SERVER2: ${{ secrets.SERVER2 }}
SERVER3: ${{ secrets.SERVER3 }}
SERVER4: ${{ secrets.SERVER4 }}
SERVER5: ${{ secrets.SERVER5 }}
SERVER6: ${{ secrets.SERVER6 }}
SERVER7: ${{ secrets.SERVER7 }}
SERVER8: ${{ secrets.SERVER8 }}
SERVER9: ${{ secrets.SERVER9 }}
SERVER10: ${{ secrets.SERVER10 }}
SERVER11: ${{ secrets.SERVER11 }}
SERVER12: ${{ secrets.SERVER12 }}
SERVER13: ${{ secrets.SERVER13 }}
SERVER14: ${{ secrets.SERVER14 }}
SERVER15: ${{ secrets.SERVER15 }}
SERVER16: ${{ secrets.SERVER16 }}
SERVER17: ${{ secrets.SERVER17 }}
SERVER18: ${{ secrets.SERVER18 }}
SERVER19: ${{ secrets.SERVER19 }}
SERVER20: ${{ secrets.SERVER20 }}
SERVER21: ${{ secrets.SERVER21 }}