Skip to content

Commit 19536e5

Browse files
committed
Add github workflow to publish the MM to github package
Signed-off-by: Laurent Fasani <laurent.fasani@obeo.fr>
1 parent 35039a0 commit 19536e5

10 files changed

Lines changed: 109 additions & 0 deletions

.github/workflows/publish.yml

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: Publish meta-model Eclipse Plugins to GitHub Packages
2+
3+
on:
4+
pull_request:
5+
push:
6+
branches:
7+
- "**"
8+
paths:
9+
- "releng/jar-for-github-publish/**"
10+
workflow_dispatch:
11+
12+
jobs:
13+
build:
14+
runs-on: ubuntu-latest
15+
permissions:
16+
contents: read
17+
id-token: write
18+
packages: write
19+
if: github.event_name != 'pull_request' || github.event.pull_request.head.repo.full_name != github.event.pull_request.base.repo.full_name
20+
21+
steps:
22+
# ------------------------------
23+
# Checkout
24+
# ------------------------------
25+
- name: Checkout code
26+
uses: actions/checkout@v4
27+
28+
# ------------------------------
29+
# Setup Java & Maven
30+
# ------------------------------
31+
- name: Set up JDK 17
32+
uses: actions/setup-java@v4
33+
with:
34+
distribution: temurin
35+
java-version: 17
36+
cache: maven
37+
38+
# ------------------------------
39+
# Install all Eclipse-plugin JARs locally
40+
# ------------------------------
41+
- name: Install all plugin JARs into local Maven repo
42+
run: |
43+
cd releng/jar-for-github-publish
44+
mkdir -p local-maven-repo
45+
46+
install_jars() {
47+
GROUP_ID="$1"
48+
JAR_PATHS="$2"
49+
50+
for jar_path in $JAR_PATHS; do
51+
echo "Installing $jar_path"
52+
53+
ARTIFACT_ID=$(basename "$jar_path" | sed 's/_.*//')
54+
VERSION=$(basename "$jar_path" | sed -n 's/.*_\([0-9]\+\.[0-9]\+\.[0-9]\+\).*/\1/p')
55+
56+
57+
mvn install:install-file \
58+
-Dfile="$jar_path" \
59+
-DgroupId="$GROUP_ID" \
60+
-DartifactId="$ARTIFACT_ID" \
61+
-Dversion="$VERSION" \
62+
-Dpackaging=jar \
63+
-DgeneratePom=true \
64+
-DlocalRepositoryPath=local-maven-repo
65+
done
66+
}
67+
68+
ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.environment_|org.obeonetwork.dsl.environment.edit_)")
69+
install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
70+
71+
ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.entity_|org.obeonetwork.dsl.entity.edit_)")
72+
install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
73+
74+
ENTITY_JAR_PATHS=$(ls | grep -E ".*(org.obeonetwork.dsl.technicalid_|org.obeonetwork.dsl.technicalid.edit_)")
75+
install_jars org.obeonetwork.dsl "$ENTITY_JAR_PATHS"
76+
77+
ENTITY_JAR_PATHS=$(ls | grep -E ".*net4j.util_")
78+
install_jars org.eclipse.emf.cdo "$ENTITY_JAR_PATHS"
79+
80+
ENTITY_JAR_PATHS=$(ls | grep -E "(.*cdo_|linux.*cdo.common_)")
81+
install_jars org.eclipse.net4j.util "$ENTITY_JAR_PATHS"
82+
83+
# ------------------------------
84+
# Publish to GitHub Packages
85+
# ------------------------------
86+
- name: Deploy all installed artifacts to GitHub Packages
87+
env:
88+
GITHUB_USER: ${{ github.actor }}
89+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
90+
run: |
91+
cd releng/jar-for-github-publish
92+
for pom in $(find local-maven-repo -name "*.pom"); do
93+
echo "Found POM: $pom"
94+
ARTIFACT_DIR=$(dirname "$pom")
95+
FILE_JAR=$(ls "$ARTIFACT_DIR"/*.jar | head -n 1)
96+
echo "Found JAR: $FILE_JAR"
97+
98+
mvn deploy:deploy-file \
99+
-DrepositoryId=github \
100+
-Durl="https://maven.pkg.github.com/${{ github.repository }}" \
101+
-Dfile="$FILE_JAR" \
102+
-DpomFile="$pom" \
103+
-DgroupId="$GROUP_ID" \
104+
-DartifactId="$ARTIFACT_ID" \
105+
-Dversion="$VERSION" \
106+
-Dpackaging=jar \
107+
-DgeneratePom=false \
108+
-Dtoken=${{ secrets.GITHUB_TOKEN }}
109+
done
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.
Binary file not shown.

0 commit comments

Comments
 (0)