Skip to content

Commit 2bb5ac9

Browse files
authored
Create work-jar.yml
1 parent ade3f6e commit 2bb5ac9

1 file changed

Lines changed: 51 additions & 0 deletions

File tree

.github/workflows/work-jar.yml

Lines changed: 51 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,51 @@
1+
name: Publish JAR to GitHub Pages
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
jobs:
9+
publish-jar:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v4
15+
16+
- name: Set up JDK 17
17+
uses: actions/setup-java@v4
18+
with:
19+
java-version: '17'
20+
distribution: 'temurin'
21+
22+
- name: Grant execute permission for gradlew
23+
run: chmod +x gradlew
24+
25+
- name: Publish Maven artifacts
26+
run: ./gradlew publishToMavenLocal
27+
env:
28+
GROUP_ID: fr.sandro642.github
29+
ARTIFACT_ID: ConnectorAPI
30+
VERSION: 0.1.0
31+
32+
- name: Clone GitHub Pages repository
33+
run: |
34+
git clone --depth 1 https://github.com/sandro642/sandro642.github.io.git gh-pages
35+
cd gh-pages
36+
git checkout main
37+
38+
- name: Copy Maven artifacts to connectorapi/jar
39+
run: |
40+
rm -rf gh-pages/connectorapi/jar/*
41+
mkdir -p gh-pages/connectorapi/jar/fr/sandro642/github/ConnectorAPI/0.1.0
42+
cp -r ~/.m2/repository/fr/sandro642/github/ConnectorAPI/0.1.0/* gh-pages/connectorapi/jar/fr/sandro642/github/ConnectorAPI/0.1.0/
43+
44+
- name: Commit and push changes
45+
run: |
46+
cd gh-pages
47+
git config user.name "GitHub Actions"
48+
git config user.email "actions@github.com"
49+
git add connectorapi/jar
50+
git commit -m "Update JAR and POM for ConnectorAPI" || echo "No changes to commit"
51+
git push https://${{ secrets.GH_TOKEN }}@github.com/sandro642/sandro642.github.io.git main

0 commit comments

Comments
 (0)