Skip to content

Commit

Permalink
workflows
Browse files Browse the repository at this point in the history
  • Loading branch information
Goulven.Furet authored and Goulven.Furet committed Jan 2, 2024
1 parent e7b3002 commit dde781c
Show file tree
Hide file tree
Showing 7 changed files with 239 additions and 54 deletions.
46 changes: 0 additions & 46 deletions .github/workflows/buildDeploy.yml

This file was deleted.

26 changes: 26 additions & 0 deletions .github/workflows/publishInfraBeta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will trigger the remote ssh script to restart infrastructure with the latest artefacts version
on: workflow_dispatch

name: Publish latest infrastructure on qualification environment

jobs:
deploy:
name: publish-infra-beta
runs-on: self-hosted

steps:
- name: Publish via ssh
uses: appleboy/ssh-action@v1.0.2
with:
host: ${{ secrets.REMOTE_BETA_HOST }}
username: ${{ secrets.REMOTE_BETA_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY}}
script: sh /opt/open4goods/bin/publish-infra.sh








Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
# restart infrastructure with the latest artefacts version
on: workflow_dispatch

name: Publish latest infrastructure
name: Publish latest infrastructure on production environment

jobs:
deploy:
name: publish-infra
name: publish-infra-prod
runs-on: self-hosted

steps:
- name: Publish via ssh
uses: appleboy/ssh-action@v1.0.0
uses: appleboy/ssh-action@v1.0.2
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
Expand Down
26 changes: 26 additions & 0 deletions .github/workflows/publishJarsBeta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
# This workflow will trigger the remote ssh script to
# restart application with the latest artefacts version
on: workflow_dispatch

name: Restart applications on qualification environment

jobs:
deploy:
name: publish-jars-beta
runs-on: self-hosted

steps:
- name: Publish via ssh
uses: appleboy/ssh-action@v1.0.2
with:
host: ${{ secrets.REMOTE_BETA_HOST }}
username: ${{ secrets.REMOTE_BETA_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY}}
script: sh /opt/open4goods/bin/publish-jars.sh







Original file line number Diff line number Diff line change
Expand Up @@ -2,19 +2,19 @@
# restart application with the latest artefacts version
on: workflow_dispatch

name: Publish latest apps
name: Restart applications on production environment

jobs:
deploy:
name: publish-jars
name: publish-jars-prod
runs-on: self-hosted

steps:
- name: Publish via ssh
uses: appleboy/ssh-action@v0.1.10
uses: appleboy/ssh-action@v1.0.2
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
host: ${{ secrets.REMOTE_BETA_HOST }}
username: ${{ secrets.REMOTE_BETA_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY}}
script: sh /opt/open4goods/bin/publish-jars.sh

Expand Down
104 changes: 104 additions & 0 deletions .github/workflows/releaseDeployProd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,104 @@
on: workflow_dispatch
name: release-deploy-prod

jobs:
release:
runs-on: ubuntu-latest
steps:


- uses: actions/checkout@v4

############################################
# Install Java
###########################################

- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
cache: maven


############################################
# Build jars
###########################################

- name: Build jars with Maven
run: mvn --batch-mode --update-snapshots install -Dmaven.test.skip=true

############################################
# Build maven site
###########################################

- name: Build Maven site
run: mvn --batch-mode clean site site:stage scm-publish:publish-scm


############################################
# Build the changelogs
###########################################

- name: Build Changelog
id: github_release
uses: mikepenz/release-changelog-builder-action@v3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

############################################
# Create the release
###########################################

- name: Create Release
uses: mikepenz/action-gh-release@v0.2.0-a03 #softprops/action-gh-release
with:
body: ${{steps.github_release.outputs.changelog}}



############################################
# Deploy API to production server
###########################################

- name: Deploy API to server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "/api/target/api-0.0.1-SNAPSHOT.jar"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: "/opt/open4goods/bin/latest/api-latest.jar"


############################################
# Deploy UI to production server
###########################################

- name: Deploy UI to production server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "/ui/target/ui-0.0.1-SNAPSHOT.jar"
REMOTE_HOST: ${{ secrets.REMOTE_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_USER }}
TARGET: "/opt/open4goods/bin/latest/ui-latest.jar"

############################################
# Restart applications
###########################################

- name: Publish applications
uses: appleboy/ssh-action@v1.0.2
with:
host: ${{ secrets.REMOTE_HOST }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY}}
script: sh /opt/open4goods/bin/publish-jars.sh





75 changes: 75 additions & 0 deletions .github/workflows/testAndPublishBeta.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
# This workflow will build, test and push the latest version on the beta environment.

on: push

name: Build, Test and publish on beta.nudger.fr

jobs:
deploy:
name: test-build-publish-beta
runs-on: self-hosted

steps:
- uses: actions/checkout@v4

############################################
# Install Java
###########################################
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
java-version: '21'
distribution: 'adopt'
cache: maven

############################################
# Maven build and testing
###########################################

- name: Build and test with Maven
run: mvn --batch-mode --update-snapshots install

############################################
# Deploy api JAR to qualification environment
###########################################

- name: Deploy API to qualification server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "/api/target/api-0.0.1-SNAPSHOT.jar"
REMOTE_HOST: ${{ secrets.REMOTE_BETA_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_BETA_USER }}
TARGET: "/opt/open4goods/bin/latest/api-latest.jar"

############################################
# Deploy ui JAR to qualification environment
###########################################

- name: Deploy UI to qualification server
uses: easingthemes/ssh-deploy@main
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
ARGS: "-rltgoDzvO --delete"
SOURCE: "/ui/target/ui-0.0.1-SNAPSHOT.jar"
REMOTE_HOST: ${{ secrets.REMOTE_BETA_HOST }}
REMOTE_USER: ${{ secrets.REMOTE_BETA_USER }}
TARGET: "/opt/open4goods/bin/latest/ui-latest.jar"

############################################
# Restarting application
###########################################

- name: Publish applications
uses: appleboy/ssh-action@v1.0.2
with:
host: ${{ secrets.REMOTE_BETA_HOST }}
username: ${{ secrets.REMOTE_BETA_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY}}
script: sh /opt/open4goods/bin/publish-jars.sh





0 comments on commit dde781c

Please sign in to comment.