Skip to content

Commit 3e9d80d

Browse files
committed
feat: enhance GitHub Actions workflow with pull request and manual trigger support
1 parent 4373741 commit 3e9d80d

File tree

1 file changed

+11
-9
lines changed

1 file changed

+11
-9
lines changed

.github/workflows/deploy.yml

Lines changed: 11 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,10 @@ on:
44
push:
55
branches:
66
- main
7+
pull_request:
8+
branches:
9+
- main
10+
workflow_dispatch:
711

812
jobs:
913
build:
@@ -34,10 +38,10 @@ jobs:
3438
- name: Setup Maven Settings
3539
run: |
3640
mkdir -p ~/.m2
37-
echo "<?xml version='1.0' encoding='UTF-8'?>
38-
<settings xsi:schemaLocation='http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd'
39-
xmlns='http://maven.apache.org/SETTINGS/1.0.0'
40-
xmlns:xsi='http://www.w3.org/2001/XMLSchema-instance'>
41+
echo '<?xml version="1.0" encoding="UTF-8"?>
42+
<settings xsi:schemaLocation="http://maven.apache.org/SETTINGS/1.0.0 http://maven.apache.org/xsd/settings-1.0.0.xsd"
43+
xmlns="http://maven.apache.org/SETTINGS/1.0.0"
44+
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
4145
<servers>
4246
<server>
4347
<id>central</id>
@@ -73,10 +77,7 @@ jobs:
7377
<activeProfiles>
7478
<activeProfile>default</activeProfile>
7579
</activeProfiles>
76-
</settings>" > ~/.m2/settings.xml
77-
78-
echo "Maven settings created. Verifying content:"
79-
cat ~/.m2/settings.xml
80+
</settings>' > ~/.m2/settings.xml
8081
8182
# Build with Maven using explicit credentials
8283
- name: Build with Maven
@@ -103,7 +104,7 @@ jobs:
103104
else
104105
echo "Error: $service build failed - JAR not found"
105106
exit 1
106-
}
107+
fi
107108
done
108109
109110
# Set up Docker buildx
@@ -176,6 +177,7 @@ jobs:
176177
deploy:
177178
runs-on: ubuntu-latest
178179
needs: build
180+
if: github.event_name == 'push' && github.ref == 'refs/heads/main'
179181
env:
180182
REGISTRY: ${{ secrets.OCI_REGISTRY }}
181183
OCI_USERNAME: ${{ secrets.OCI_USERNAME }}

0 commit comments

Comments
 (0)