Compare commits
2 Commits
2526cb0c53
...
02b798b01b
| Author | SHA1 | Date | |
|---|---|---|---|
| 02b798b01b | |||
|
|
2aa0e3eb3e |
@@ -1,15 +1,15 @@
|
|||||||
name: Master-Build
|
name: Main-Build
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
branches: ["master"]
|
branches: ["main"]
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-war:
|
build-and-push:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-latest
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- name: Checkout source
|
- name: Checkout
|
||||||
uses: actions/checkout@v4
|
uses: actions/checkout@v4
|
||||||
|
|
||||||
- name: Set up JDK 8
|
- name: Set up JDK 8
|
||||||
@@ -18,34 +18,21 @@ jobs:
|
|||||||
distribution: temurin
|
distribution: temurin
|
||||||
java-version: "8"
|
java-version: "8"
|
||||||
|
|
||||||
- name: Cache Maven repo
|
- name: Maven Build WAR
|
||||||
uses: actions/cache@v4
|
run: mvn -B clean package -DskipTests
|
||||||
with:
|
|
||||||
path: ~/.m2
|
|
||||||
key: m2-${{ runner.os }}-${{ hashFiles('**/pom.xml') }}
|
|
||||||
restore-keys: |
|
|
||||||
m2-${{ runner.os }}-
|
|
||||||
|
|
||||||
- name: Configure Maven Settings for Nexus
|
- name: Docker login to Harbor
|
||||||
run: |
|
run: |
|
||||||
mkdir -p ~/.m2
|
echo "${{ secrets.HARBOR_PASSWORD }}" | docker login harbor.sayinfo.co.kr -u ${{ secrets.HARBOR_USERNAME }} --password-stdin
|
||||||
cat > ~/.m2/settings.xml <<EOF
|
|
||||||
<settings>
|
|
||||||
<servers>
|
|
||||||
<server>
|
|
||||||
<id>nexus</id>
|
|
||||||
<username>${{ secrets.NEXUS_USERNAME }}</username>
|
|
||||||
<password>${{ secrets.NEXUS_PASSWORD }}</password>
|
|
||||||
</server>
|
|
||||||
</servers>
|
|
||||||
</settings>
|
|
||||||
EOF
|
|
||||||
|
|
||||||
- name: Maven deploy (WAR to Nexus)
|
- name: Build Docker image
|
||||||
run: mvn -B clean deploy -DskipTests
|
run: |
|
||||||
|
docker build -t sayit-helpdesk:latest .
|
||||||
|
|
||||||
- name: Upload WAR artifact (optional)
|
- name: Tag image for Harbor
|
||||||
uses: actions/upload-artifact@v4
|
run: |
|
||||||
with:
|
docker tag sayit-helpdesk:latest harbor.sayinfo.co.kr/helpdesk/helpdesk-service:latest
|
||||||
name: sayit-helpdesk-war
|
|
||||||
path: target/sayit.helpdesk.war
|
- name: Push image to Harbor
|
||||||
|
run: |
|
||||||
|
docker push harbor.sayinfo.co.kr/helpdesk/helpdesk-service:latest
|
||||||
|
|||||||
Reference in New Issue
Block a user