Skip to content

Commit 8adf373

Browse files
committed
[chore]create deploy pipeline
1 parent 2b52abd commit 8adf373

File tree

3 files changed

+98
-6
lines changed

3 files changed

+98
-6
lines changed

.github/workflows/build.yaml

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
name: Build and Test
2+
3+
on:
4+
workflow_dispatch:
5+
pull_request:
6+
types: [opened, synchronize, reopened]
7+
branches:
8+
- master
9+
push:
10+
branches:
11+
- master
12+
13+
jobs:
14+
build:
15+
runs-on: ubuntu-latest
16+
17+
env:
18+
MAVEN_OPTS: -Xmx2g
19+
20+
steps:
21+
- name: Checkout code
22+
uses: actions/checkout@v4
23+
24+
- name: Set up JDK
25+
uses: actions/setup-java@v4
26+
with:
27+
java-version: '21'
28+
distribution: 'temurin'
29+
cache: 'maven'
30+
31+
- name: Run tests
32+
run: |
33+
mvn test \
34+
--batch-mode \
35+
--fail-at-end \
36+
-Dsurefire.useFile=false
37+
38+
- name: Build project
39+
run: |
40+
mvn package \
41+
--batch-mode \
42+
-DskipTests=true
43+
44+
- name: Upload test results
45+
if: always()
46+
uses: actions/upload-artifact@v4
47+
with:
48+
name: test-results
49+
path: '**/target/surefire-reports/*.xml'
50+
retention-days: 7

.github/workflows/deploy.yaml

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
name: Deploy to AWS Maven Repository
2+
3+
on:
4+
workflow_dispatch:
5+
push:
6+
tags:
7+
- 'nulab-*'
8+
9+
permissions:
10+
id-token: write
11+
contents: read
12+
13+
jobs:
14+
deploy:
15+
runs-on: ubuntu-latest
16+
steps:
17+
- name: Checkout code
18+
uses: actions/checkout@v4
19+
20+
- name: Set up JDK
21+
uses: actions/setup-java@v4
22+
with:
23+
java-version: '21'
24+
distribution: 'temurin'
25+
cache: 'maven'
26+
27+
- name: Configure AWS Credentials
28+
uses: aws-actions/configure-aws-credentials@main
29+
with:
30+
role-to-assume: ${{ secrets.AWS_ROLE_ARN }}
31+
aws-region: ${{ secrets.AWS_REGION }}
32+
33+
- name: Deploy flexmark-all to AWS Maven Repository
34+
env:
35+
MAVEN_REPOSITORY_ID: ${{ secrets.MAVEN_REPOSITORY_ID }}
36+
MAVEN_REPOSITORY_URL: ${{ secrets.MAVEN_REPOSITORY_URL }}
37+
run: |
38+
mvn deploy -pl flexmark-all -am -DskipTests=true

pom.xml

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -92,17 +92,21 @@
9292
</properties>
9393

9494
<distributionManagement>
95-
<snapshotRepository>
96-
<id>ossrh</id>
97-
<url>https://oss.sonatype.org/content/repositories/snapshots</url>
98-
</snapshotRepository>
9995
<repository>
100-
<id>ossrh</id>
101-
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url>
96+
<id>${env.MAVEN_REPOSITORY_ID}</id>
97+
<name>AWS Repository</name>
98+
<url>${env.MAVEN_REPOSITORY_URL}</url>
10299
</repository>
103100
</distributionManagement>
104101

105102
<build>
103+
<extensions>
104+
<extension>
105+
<groupId>io.github.embriq-nordic</groupId>
106+
<artifactId>aws-oidc-s3-maven-wagon</artifactId>
107+
<version>1.2.0</version>
108+
</extension>
109+
</extensions>
106110
<pluginManagement>
107111
<plugins>
108112
<plugin>

0 commit comments

Comments
 (0)