Skip to content

Commit 43f69f1

Browse files
Update maven.yml
1 parent da03760 commit 43f69f1

File tree

1 file changed

+11
-62
lines changed

1 file changed

+11
-62
lines changed

.github/workflows/maven.yml

Lines changed: 11 additions & 62 deletions
Original file line numberDiff line numberDiff line change
@@ -1,70 +1,19 @@
1-
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time
2-
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven
3-
4-
# This workflow uses actions that are not certified by GitHub.
5-
# They are provided by a third-party and are governed by
6-
# separate terms of service, privacy policy, and support
7-
# documentation.
8-
9-
name: Java CI with Maven
10-
1+
name: Maven Reusable Workflow
2+
run-name: GitHub Action Maven Reusable Workflow
113
on:
12-
push:
13-
branches: [ "master" ]
14-
pull_request:
15-
branches: [ "master" ]
4+
workflow_dispatch:
5+
workflow_call:
166

177
jobs:
18-
build:
19-
8+
Maven-Workflow:
209
runs-on: ubuntu-latest
21-
2210
steps:
23-
- uses: actions/checkout@v3
24-
- name: Set up JDK 17
25-
uses: actions/setup-java@v3
26-
with:
11+
- uses: actions/checkout@v3
12+
- name: Set up JDK 17
13+
uses: actions/setup-java@v3
14+
with:
2715
java-version: '17'
2816
distribution: 'temurin'
2917
cache: maven
30-
- name: Build with Maven
31-
run: mvn -B package --file pom.xml
32-
33-
- uses: actions/upload-artifact@v4
34-
with:
35-
name: buildArtifact
36-
path: target/*.jar
37-
38-
Deployment:
39-
40-
runs-on: ubuntu-latest
41-
needs: build
42-
strategy:
43-
matrix:
44-
deployHosts: ${{ fromJson(vars.HOSTLIST) }}
45-
steps:
46-
- uses: actions/download-artifact@v4
47-
with:
48-
name: buildArtifact
49-
path: .
50-
- name: Deploy Artifacts
51-
run: ls -laRt
52-
- name: copy file to server
53-
uses: appleboy/[email protected]
54-
with:
55-
host: ${{ matrix.deployHosts }}
56-
username: ${{ secrets.USERNAME }}
57-
password: ${{ secrets.PASS }}
58-
port: 22
59-
source: '*.jar'
60-
target: /tmp/
61-
- name: executing remote ssh commands using password
62-
uses: appleboy/[email protected]
63-
with:
64-
host: ${{ matrix.deployHosts }}
65-
username: ${{ secrets.USERNAME }}
66-
password: ${{ secrets.PASS }}
67-
port: 22
68-
script: |
69-
sudo cp /tmp/*.jar /opt/
70-
sudo ls -lart /opt
18+
- name: Build with Maven
19+
run: mvn -B package --file pom.xml

0 commit comments

Comments
 (0)