Compare commits
2 commits
10b0e0e2b7
...
a9f02635f1
Author | SHA1 | Date | |
---|---|---|---|
a9f02635f1 | |||
fe81de07e3 |
5 changed files with 90 additions and 49 deletions
38
.github/workflows/deploy.yml
vendored
38
.github/workflows/deploy.yml
vendored
|
@ -1,39 +1,15 @@
|
||||||
name: Deploy
|
name: Deploy (Production)
|
||||||
|
|
||||||
on:
|
on: workflow_dispatch
|
||||||
workflow_dispatch:
|
|
||||||
inputs:
|
|
||||||
hostname:
|
|
||||||
description: Hostname
|
|
||||||
type: string
|
|
||||||
required: true
|
|
||||||
default: antville.org
|
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
stage:
|
deploy:
|
||||||
runs-on: antville
|
runs-on: antville
|
||||||
|
|
||||||
environment:
|
environment:
|
||||||
name: production
|
name: antville.org
|
||||||
url: ${{ inputs.hostname }}
|
url: https://antville.org
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v4
|
- name: Copy files to production server
|
||||||
|
run: ssh staging-server deploy-helma
|
||||||
- name: Build with Gradle
|
|
||||||
run: ./gradlew installDist
|
|
||||||
|
|
||||||
- name: Copy build files to server
|
|
||||||
run: |
|
|
||||||
rsync ./build/install/helma/ ${{ inputs.hostname }}:./ \
|
|
||||||
--verbose --archive --delete --compress \
|
|
||||||
--filter '+ /bin' \
|
|
||||||
--filter '+ /extras' \
|
|
||||||
--filter '+ /launcher.jar' \
|
|
||||||
--filter '- /lib/ext' \
|
|
||||||
--filter '+ /lib' \
|
|
||||||
--filter '+ /modules' \
|
|
||||||
--filter '- /*'
|
|
||||||
|
|
||||||
- name: Restart Helma
|
|
||||||
run: ssh ${{ inputs.hostname }} restart
|
|
||||||
|
|
32
.github/workflows/stage.yml
vendored
Normal file
32
.github/workflows/stage.yml
vendored
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
name: Deploy (Staging)
|
||||||
|
|
||||||
|
on: workflow_dispatch
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
stage:
|
||||||
|
runs-on: antville
|
||||||
|
|
||||||
|
environment:
|
||||||
|
name: stage
|
||||||
|
url: ${{ vars.stage_url }}
|
||||||
|
|
||||||
|
steps:
|
||||||
|
- uses: actions/checkout@v4
|
||||||
|
|
||||||
|
- name: Build with Gradle
|
||||||
|
run: ./gradlew installDist
|
||||||
|
|
||||||
|
- name: Publish to staging server
|
||||||
|
run: |
|
||||||
|
rsync ./build/install/helma/ staging-server:./ \
|
||||||
|
--verbose --archive --delete --compress \
|
||||||
|
--filter '+ /bin' \
|
||||||
|
--filter '+ /extras' \
|
||||||
|
--filter '+ /launcher.jar' \
|
||||||
|
--filter '- /lib/ext' \
|
||||||
|
--filter '+ /lib' \
|
||||||
|
--filter '+ /modules' \
|
||||||
|
--filter '- /*'
|
||||||
|
|
||||||
|
- name: Restart Helma
|
||||||
|
run: ssh staging-server restart
|
22
.gitignore
vendored
22
.gitignore
vendored
|
@ -1,7 +1,5 @@
|
||||||
# Generally ignore hidden files
|
|
||||||
.*
|
.*
|
||||||
|
|
||||||
# Manage some Codium configuration
|
|
||||||
.vscode/*
|
.vscode/*
|
||||||
!.vscode
|
!.vscode
|
||||||
!.vscode/extensions.json
|
!.vscode/extensions.json
|
||||||
|
@ -9,22 +7,22 @@
|
||||||
!.vscode/settings.json
|
!.vscode/settings.json
|
||||||
!.vscode/tasks.json
|
!.vscode/tasks.json
|
||||||
|
|
||||||
# Ignore files created during build or run
|
build
|
||||||
|
|
||||||
|
/apps
|
||||||
/bin
|
/bin
|
||||||
/backups
|
/backups
|
||||||
build
|
/db
|
||||||
/docs
|
/docs
|
||||||
|
/extras
|
||||||
/lib
|
/lib
|
||||||
/licenses
|
/licenses
|
||||||
/log
|
/log
|
||||||
|
|
||||||
# Ignore files managed in src/dist
|
|
||||||
/*.properties
|
|
||||||
/apps
|
|
||||||
/db
|
|
||||||
/extras
|
|
||||||
/launcher.jar
|
|
||||||
/static
|
/static
|
||||||
|
|
||||||
# Manage Gradle configuration
|
/*.properties
|
||||||
!/gradle.properties
|
!/gradle.properties
|
||||||
|
|
||||||
|
/launcher.jar
|
||||||
|
/passwd
|
||||||
|
/start.*
|
||||||
|
|
|
@ -147,11 +147,9 @@ installDist {
|
||||||
dependsOn build
|
dependsOn build
|
||||||
}
|
}
|
||||||
|
|
||||||
def processSource = tasks.register('processSource', Sync) {
|
tasks.register('processSource', Sync) {
|
||||||
def gitOutput = new ByteArrayOutputStream()
|
def gitOutput = new ByteArrayOutputStream()
|
||||||
|
|
||||||
outputs.dir "${project.buildDir}/src"
|
|
||||||
|
|
||||||
exec {
|
exec {
|
||||||
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
commandLine 'git', 'rev-parse', '--short', 'HEAD'
|
||||||
standardOutput = gitOutput
|
standardOutput = gitOutput
|
||||||
|
@ -166,11 +164,9 @@ def processSource = tasks.register('processSource', Sync) {
|
||||||
.replaceAll('__builddate__', new Date().format("d MMM yyyy"))
|
.replaceAll('__builddate__', new Date().format("d MMM yyyy"))
|
||||||
.replaceAll('__commithash__', gitOutput.toString().trim())
|
.replaceAll('__commithash__', gitOutput.toString().trim())
|
||||||
.replaceAll('__version__', version)
|
.replaceAll('__version__', version)
|
||||||
} into outputs.files.singleFile
|
} into "${project.buildDir}/src"
|
||||||
}
|
}
|
||||||
|
|
||||||
tasks.compileJava.source = processSource.map { it.outputs.files }
|
|
||||||
|
|
||||||
tasks.register('update') {
|
tasks.register('update') {
|
||||||
dependsOn installDist
|
dependsOn installDist
|
||||||
|
|
||||||
|
|
39
src/dist/extras/deploy.sh
vendored
Executable file → Normal file
39
src/dist/extras/deploy.sh
vendored
Executable file → Normal file
|
@ -3,11 +3,50 @@
|
||||||
# Use this script as forced command of an authorized SSH key:
|
# Use this script as forced command of an authorized SSH key:
|
||||||
# command="/home/helma/extras/deploy.sh" ssh-ed25519 AAAAC3NzaC…
|
# command="/home/helma/extras/deploy.sh" ssh-ed25519 AAAAC3NzaC…
|
||||||
|
|
||||||
|
# Define HELMA_HOST and ANTVILLE_HOST in this file
|
||||||
|
# shellcheck source=/dev/null
|
||||||
|
. "$HOME"/deploy.env
|
||||||
|
|
||||||
case "$SSH_ORIGINAL_COMMAND" in
|
case "$SSH_ORIGINAL_COMMAND" in
|
||||||
ping)
|
ping)
|
||||||
echo pong
|
echo pong
|
||||||
;;
|
;;
|
||||||
|
|
||||||
|
deploy-helma)
|
||||||
|
rsync ./ "$HELMA_HOST":./ \
|
||||||
|
--archive --compress --delete --verbose \
|
||||||
|
--filter '+ /bin' \
|
||||||
|
--filter '+ /extras' \
|
||||||
|
--filter '+ /launcher.jar' \
|
||||||
|
--filter '- /lib/ext' \
|
||||||
|
--filter '+ /lib' \
|
||||||
|
--filter '+ /modules' \
|
||||||
|
--filter '- /*'
|
||||||
|
printf 'Restarting Helma on HELMA_host… '
|
||||||
|
ssh "$HELMA_HOST" sudo /bin/systemctl restart helma
|
||||||
|
;;
|
||||||
|
|
||||||
|
deploy-antville)
|
||||||
|
rsync ./apps/antville/ "$ANTVILLE_HOST":./apps/antville/ \
|
||||||
|
--archive --compress --delete --verbose \
|
||||||
|
--filter '+ /claustra' \
|
||||||
|
--filter '+ /code' \
|
||||||
|
--filter '+ /compat' \
|
||||||
|
--filter '+ /i18n' \
|
||||||
|
--filter '+ /lib' \
|
||||||
|
--filter '- /*'
|
||||||
|
rsync ./apps/antville/static/helma/ "$ANTVILLE_HOST":./apps/antville/static/helma/ \
|
||||||
|
--archive --compress --verbose \
|
||||||
|
--filter '+ /fonts' \
|
||||||
|
--filter '+ /formica.html' \
|
||||||
|
--filter '+ /img' \
|
||||||
|
--filter '+ /scripts' \
|
||||||
|
--filter '+ /styles' \
|
||||||
|
--filter '- /*'
|
||||||
|
printf 'Restarting Helma on ANTVILLE_host… '
|
||||||
|
ssh "$ANTVILLE_HOST" sudo /bin/systemctl restart helma
|
||||||
|
;;
|
||||||
|
|
||||||
restart)
|
restart)
|
||||||
printf 'Restarting Helma… '
|
printf 'Restarting Helma… '
|
||||||
sudo /bin/systemctl restart helma
|
sudo /bin/systemctl restart helma
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue