Skip to content

Commit 2ea1405

Browse files
committed
[feature] Add a GitHub Actions Job to deploy updates to the server
1 parent bda5480 commit 2ea1405

4 files changed

Lines changed: 62 additions & 5 deletions

File tree

.github/workflows/ci.yml

Lines changed: 54 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,4 +17,57 @@ jobs:
1717
with:
1818
distribution: 'liberica'
1919
java-version: ${{ matrix.jdk }}
20-
- run: mvn clean package
20+
- run: mvn clean package
21+
- name: Persist built XAR
22+
if: matrix.os == 'ubuntu-latest' && matrix.jdk == '8'
23+
uses: actions/upload-artifact@v4
24+
with:
25+
name: xar
26+
path: target/manuforma-*.xar
27+
if-no-files-found: error
28+
retention-days: 1
29+
overwrite: true
30+
- name: Persist built ci-resources
31+
if: matrix.os == 'ubuntu-latest' && matrix.jdk == '8'
32+
uses: actions/upload-artifact@v4
33+
with:
34+
name: ci-resources
35+
path: target/classes/ci-resources/*
36+
if-no-files-found: error
37+
retention-days: 1
38+
overwrite: true
39+
40+
deploy:
41+
needs: build
42+
name: Deploy
43+
runs-on: ubuntu-latest
44+
environment: manuforma-dev
45+
steps:
46+
- name: Retrieve built XAR
47+
uses: actions/download-artifact@v4
48+
with:
49+
name: xar
50+
- name: Retrieve built ci-resources
51+
uses: actions/download-artifact@v4
52+
with:
53+
name: ci-resources
54+
- name: Set scripts as executable
55+
run: chmod +x upload-remote-tmp-xar.sh redeploy-xar-package.sh delete-remote-tmp-xar.sh
56+
- name: Upload temp XAR to Remote Database Server
57+
env:
58+
REMOTE_EDB_SERVER_USERNAME: ${{ secrets.REMOTE_EDB_SERVER_USERNAME }}
59+
REMOTE_EDB_SERVER_PASSWORD: ${{ secrets.REMOTE_EDB_SERVER_PASSWORD }}
60+
REMOTE_EDB_SERVER_URL: ${{ secrets.REMOTE_EDB_SERVER_URL }}
61+
run: ./upload-remote-tmp-xar.sh
62+
- name: Redeploy XAR on Remote Database Server
63+
env:
64+
REMOTE_EDB_SERVER_USERNAME: ${{ secrets.REMOTE_EDB_SERVER_USERNAME }}
65+
REMOTE_EDB_SERVER_PASSWORD: ${{ secrets.REMOTE_EDB_SERVER_PASSWORD }}
66+
REMOTE_EDB_SERVER_URL: ${{ secrets.REMOTE_EDB_SERVER_URL }}
67+
run: ./redeploy-xar-package.sh
68+
- name: Delete temp XAR from Remote Database Server
69+
env:
70+
REMOTE_EDB_SERVER_USERNAME: ${{ secrets.REMOTE_EDB_SERVER_USERNAME }}
71+
REMOTE_EDB_SERVER_PASSWORD: ${{ secrets.REMOTE_EDB_SERVER_PASSWORD }}
72+
REMOTE_EDB_SERVER_URL: ${{ secrets.REMOTE_EDB_SERVER_URL }}
73+
run: ./delete-remote-tmp-xar.sh

src/main/ci-resources/delete-remote-tmp-xar.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set -e
44

55
# Deletes a XAR file on a remote database server
66
## Expects the following environment variables:
7-
# GITHUB_WORKSPACE - path to the checked out git project
87
# REMOTE_EDB_SERVER_USERNAME - username for authenticating to the remote database server
98
# REMOTE_EDB_SERVER_PASSWORD - password for authenticating to the remote database server
109
# REMOTE_EDB_SERVER_URL - URL of a remote database server to upload the XAR file into

src/main/ci-resources/redeploy-xar-package.sh

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@ set -e
44

55
# Send a query to have a remote database server redeploy a XAR package
66
## Expects the following environment variables:
7-
# GITHUB_WORKSPACE - path to the checked out git project
87
# REMOTE_EDB_SERVER_USERNAME - username for authenticating to the remote database server
98
# REMOTE_EDB_SERVER_PASSWORD - password for authenticating to the remote database server
109
# REMOTE_EDB_SERVER_URL - URL of a remote database server to upload the XAR file into

src/main/ci-resources/upload-remote-tmp-xar.sh

Lines changed: 8 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,11 +2,17 @@
22

33
set -e
44

5+
56
# Uploads a XAR file to a remote database server
67
## Expects the following environment variables:
7-
# GITHUB_WORKSPACE - path to the checked out git project
88
# REMOTE_EDB_SERVER_USERNAME - username for authenticating to the remote database server
99
# REMOTE_EDB_SERVER_PASSWORD - password for authenticating to the remote database server
1010
# REMOTE_EDB_SERVER_URL - URL of a remote database server to upload the XAR file into
1111

12-
curl --request PUT --basic --user "${REMOTE_EDB_SERVER_USERNAME}:${REMOTE_EDB_SERVER_PASSWORD}" --header 'Content-Type: application/expath+xar' --data-binary "@$GITHUB_WORKSPACE/target/${package-final-name}.xar" "${REMOTE_EDB_SERVER_URL}/rest${db-tmp-collection}/${package-final-name}.xar"
12+
if [ $# -eq 0 ]; then
13+
XAR_PATH="${package-final-name}.xar"
14+
else
15+
XAR_PATH=$1
16+
fi
17+
18+
curl --request PUT --basic --user "${REMOTE_EDB_SERVER_USERNAME}:${REMOTE_EDB_SERVER_PASSWORD}" --header 'Content-Type: application/expath+xar' --data-binary "@${XAR_PATH}" "${REMOTE_EDB_SERVER_URL}/rest${db-tmp-collection}/${package-final-name}.xar"

0 commit comments

Comments
 (0)