Skip to content

Commit

Permalink
ci: add deploy to staging
Browse files Browse the repository at this point in the history
  • Loading branch information
astappiev committed Oct 6, 2023
1 parent 2ab3bf8 commit 9f05726
Show file tree
Hide file tree
Showing 4 changed files with 55 additions and 126 deletions.
37 changes: 14 additions & 23 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,8 @@
name: test
name: CI

on:
push:
branches:
- main

env:
MVN: mvn --show-version --batch-mode --quiet
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
pull_request:

jobs:
styles:
Expand All @@ -22,8 +17,11 @@ jobs:
- run: npm run lint:scss --silent
- run: npm run lint:js --silent

lint:
java:
runs-on: ubuntu-latest
env:
MVN: mvn --batch-mode
GITHUB_TOKEN: ${{ secrets.GH_PAT }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
Expand All @@ -32,19 +30,12 @@ jobs:
distribution: 'temurin'
cache: 'maven'
server-id: github-l3s-learnweb
- run: $MVN checkstyle:check
- run: $MVN compile spotbugs:check

test:
runs-on: ubuntu-latest
needs:
- lint
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: github-l3s-learnweb
- run: $MVN test
- name: checkstyle
run: $MVN checkstyle:check

- name: spotbugs
run: $MVN compile spotbugs:check

- name: test
run: $MVN --show-version test
39 changes: 39 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Deploy

on:
workflow_run:
workflows: [ CI ]
types: [ completed ]
branches: [ main ]

jobs:
build:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
steps:
- uses: actions/checkout@v4
- uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
cache: 'maven'
server-id: github-l3s-learnweb

- run: mvn --quiet -P prod,!local -Dmaven.test.skip=true install
env:
GITHUB_TOKEN: ${{ secrets.GH_PAT }}

- uses: actions/upload-artifact@v3
with:
name: learnweb-war
path: target/Learnweb.war

deploy-dev:
runs-on: ubuntu-latest
needs: [ build ]
steps:
- uses: actions/download-artifact@v3
with:
name: learnweb-war

- run: ls -l -R
86 changes: 0 additions & 86 deletions .gitlab-ci.yml

This file was deleted.

19 changes: 2 additions & 17 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -475,21 +475,6 @@
</webResources>
</configuration>
</plugin>
<!-- Used to deploy application to Tomcat instance -->
<plugin>
<groupId>org.apache.tomcat.maven</groupId>
<artifactId>tomcat7-maven-plugin</artifactId>
<version>2.2</version>
<configuration>
<url>http://learnweb.l3s.uni-hannover.de:8100/manager/text</url>
<!--suppress UnresolvedMavenProperty -->
<username>${env.LEARNWEB_TOMCAT_USERNAME}</username>
<!--suppress UnresolvedMavenProperty -->
<password>${env.LEARNWEB_TOMCAT_PASSWORD}</password>
<!--suppress UnresolvedMavenProperty -->
<path>/${path}##${project.version}</path>
</configuration>
</plugin>
<!-- Can be used to run the application without Tomcat server -->
<plugin>
<groupId>org.eclipse.jetty</groupId>
Expand Down Expand Up @@ -553,7 +538,7 @@
<configuration>
<rules>
<requireMavenVersion>
<version>[3.6,)</version>
<version>[3.8,)</version>
</requireMavenVersion>
<requireJavaVersion>
<version>[17,)</version>
Expand Down Expand Up @@ -584,7 +569,7 @@
</resources>
</build>
</profile>
<!-- Used on GitLab when creating package to deploy -->
<!-- Used when creating packages to deploy -->
<profile>
<id>prod</id>
<properties>
Expand Down

0 comments on commit 9f05726

Please sign in to comment.