-
Notifications
You must be signed in to change notification settings - Fork 382
104 lines (102 loc) · 3.62 KB
/
production.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
# Deploy to Production
name: production
on:
workflow_dispatch:
inputs:
git-ref:
description: 'Git Ref to Deploy (hash: 40 hex digits)'
required: true
option:
description: use --override to allow any ref
required: false
default: ''
jobs:
build:
name: Build for Production
runs-on: ubuntu-latest
steps:
- name: Clone Repository (Custom Ref)
uses: actions/checkout@v4
with:
ref: ${{ github.event.inputs.git-ref }}
lfs: false
- name: Calculate Tag Name
id: tagname
run: >
echo "::set-output name=tag::$(env TZ=UTC date +'production/%Y-%m-%d-%H%Mz')"
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: 11
distribution: 'temurin'
- name: Cache local Maven repository
uses: actions/cache@v4
with:
path: ~/.m2/repository
key: ${{ runner.os }}-maven-${{ hashFiles('tools/**/pom.xml') }}
restore-keys: |
${{ runner.os }}-maven-
- name: Cache local npm repository
uses: actions/cache@v4
with:
path: ~/.npm
key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-node-
node-
- name: Build with Maven
run: >
mvn -s .github/workflows/mvn-settings.xml -B compile install package --file tools/pom.xml
-DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Build liberty server
run: >
mvn -s .github/workflows/mvn-settings.xml -B -pl cldr-apps liberty:create liberty:deploy liberty:package -Dinclude=usr --file tools/pom.xml
-DskipTests=true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Cleanup liberty server
run: >
zip tools/cldr-apps/target/cldr-apps.zip -d wlp/usr/servers/cldr/apps/expanded/\*
- name: Upload cldr-apps.zip
uses: actions/upload-artifact@v4
with:
name: cldr-apps-server
path: tools/cldr-apps/target/cldr-apps.zip
- name: Create Release for Production
uses: ncipollo/[email protected]
with:
commit: ${{ github.event.inputs.git-ref }}
prerelease: true
tag: "${{ steps.tagname.outputs.tag }}"
body: "Automated release from ’production’ Action"
deploy:
name: Deploy to Production
needs:
- build
runs-on: ubuntu-latest
steps:
- name: Download cldr-apps.zip
uses: actions/download-artifact@v4
with:
name: cldr-apps-server
- name: Deploy to st
# Deploys only on push to main.
# Does not deploy for PRs.
shell: bash
env:
# the RSA key for connecting
RSA_KEY_SURVEYTOOL: ${{ secrets.RSA_KEY_SURVEYTOOL }}
# the SSH port
SURVEYTOOL_PORT: ${{ secrets.SURVEYTOOL_PORT }}
# the SSH host
SURVEYTOOL_HOST: ${{ secrets.SURVEYTOOL_HOST }}
# the ~/.ssh/known_hosts line mentioning SMOKETEST_HOST
SURVEYTOOL_KNOWNHOSTS: ${{ secrets.SURVEYTOOL_KNOWNHOSTS }}
DEPLOY_SHA: ${{ github.event.inputs.git-ref }}
OVERRIDE: ${{ github.event.inputs.override }}
run: |
echo "${RSA_KEY_SURVEYTOOL}" > .key && chmod go= .key
echo "${SURVEYTOOL_KNOWNHOSTS}" > .knownhosts && chmod go= .knownhosts
ssh -C -o UserKnownHostsFile=.knownhosts -i .key -p ${SURVEYTOOL_PORT} surveytool@${SURVEYTOOL_HOST} bash /usr/local/bin/deploy-to-openliberty.sh < cldr-apps.zip ${DEPLOY_SHA} ${OVERRIDE}