Skip to content

Commit 6b2518b

Browse files
authored
deploy github pages
Added permissions and concurrency settings for GitHub Actions workflow.
1 parent 59502ac commit 6b2518b

File tree

1 file changed

+33
-5
lines changed

1 file changed

+33
-5
lines changed

.github/workflows/maven.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -6,23 +6,32 @@ on:
66
pull_request:
77
branches: ["master"]
88

9+
permissions:
10+
contents: read
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
918
jobs:
1019
build:
1120
runs-on: ubuntu-latest
12-
21+
1322
steps:
1423
- uses: actions/checkout@v4
15-
24+
1625
- name: Set up JDK
1726
uses: actions/setup-java@v4
1827
with:
19-
java-version: '21' # Updated to latest LTS
28+
java-version: '21'
2029
distribution: 'temurin'
2130
cache: 'maven'
22-
31+
2332
- name: Build with Maven
2433
run: mvn -B package --file pom.xml
25-
34+
2635
- name: Run tests
2736
run: mvn -B test
2837

@@ -33,3 +42,22 @@ jobs:
3342
name: package
3443
path: target/*.jar
3544
retention-days: 5
45+
46+
- name: Upload Pages artifact
47+
if: github.ref == 'refs/heads/master' && success()
48+
uses: actions/upload-pages-artifact@v3
49+
with:
50+
path: target/site # Change this to your docs/site output folder
51+
52+
deploy:
53+
environment:
54+
name: github-pages
55+
url: ${{ steps.deployment.outputs.page_url }}
56+
runs-on: ubuntu-latest
57+
needs: build
58+
if: github.ref == 'refs/heads/master'
59+
60+
steps:
61+
- name: Deploy to GitHub Pages
62+
id: deployment
63+
uses: actions/deploy-pages@v4

0 commit comments

Comments
 (0)