Skip to content

Commit

Permalink
Github Actions workflow toegevoegd die Imvertor build en deployed naa…
Browse files Browse the repository at this point in the history
…r Github Packages. Hiertoe tevens enkele noodzakelijke wijzigingen doorgevoerd in pom.xml.
  • Loading branch information
maartenkroon committed Oct 26, 2024
1 parent 3727d28 commit a14f04a
Show file tree
Hide file tree
Showing 3 changed files with 162 additions and 11 deletions.
90 changes: 90 additions & 0 deletions .github/workflows/build-package-development.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
name: Build and Package development branch

on:
workflow_dispatch:
push:
branches:
- Development
release:
types: [created]

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
with:
ref: Development
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'temurin'
server-id: github # Value of the distributionManagement/repository/id field of the pom.xml
settings-path: ${{ github.workspace }} # location for the settings.xml file

- name: Maven Clean
run: mvn clean

- name: Maven Install
run: mvn install

- name: Build with Maven
run: mvn -B package --file pom.xml

- name: Extract Maven project groupId
run: echo "maven_groupId=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.groupId}' --non-recursive exec:exec)" >> "$GITHUB_ENV"
- name: Extract Maven project artifactId
run: echo "maven_artifactId=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.artifactId}' --non-recursive exec:exec)" >> "$GITHUB_ENV"
- name: Extract Maven project version
run: echo "maven_version=$(mvn -q -Dexec.executable=echo -Dexec.args='${project.version}' --non-recursive exec:exec)" >> "$GITHUB_ENV"

- name: Show extracted Maven project groupId, artifactId, version
run: printf '%s\n' "$maven_groupId" "$maven_artifactId" "$maven_version"

- name: Delete package or package version
uses: actions/github-script@v7
id: delete-package-version
with:
script: |
const packageName = process.env.maven_groupId + '.' + process.env.maven_artifactId
const org = context.repo.owner
const versionInfo = await github.rest.packages.getAllPackageVersionsForPackageOwnedByOrg({
package_type: 'maven',
package_name: packageName,
org: org,
})
const versions = versionInfo.data
for (const version of versions) {
if (version.name == process.env.maven_version) {
/* This version is the maven version we want to delete: */
if (versions.length == 1) {
/* This version is the last version of the package so we have to delete the complete package: */
await github.rest.packages.deletePackageForOrg({
package_type: 'maven',
package_name: packageName,
org: context.repo.owner,
});
} else {
/* Remove this version from the package: */
await github.rest.packages.deletePackageVersionForOrg({
package_type: 'maven',
package_name: packageName,
org: context.repo.owner,
package_version_id: version.id,
});
}
break;
}
}
- name: Publish to GitHub Packages Apache Maven
run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
Binary file added lib/eaapi.jar
Binary file not shown.
83 changes: 72 additions & 11 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">

<modelVersion>4.0.0</modelVersion>
<groupId>Imvertor</groupId>
<artifactId>Imvertor</artifactId>
<version>1-SNAPSHOT</version>
<groupId>nl.imvertor</groupId>
<artifactId>imvertor</artifactId>
<version>0.9.9</version>
<name>Imvertor</name>

<description>Imvertor under Maven</description>
Expand All @@ -15,6 +15,7 @@
<!-- MSL = mozilla license, https://www.mozilla.org/en-US/MPL/2.0/ -->
<!-- ESL = Eclipse software license, http://www.eclipse.org/legal/epl-v10.html -->


<repositories>
<repository>
<id>repos-armatiek</id>
Expand Down Expand Up @@ -220,15 +221,10 @@
<version>1.8.0-beta2</version>
</dependency>

<!-- non-mavenized depencies below; dependency on enterprise architect should be removed -->
<!-- note that they might have to distributed seperately due to copyright issues -->
<dependency>
<groupId>enterprise.architect</groupId>
<artifactId>java-api</artifactId>
<version>1.0</version>
<scope>system</scope>
<systemPath>${env.EAPATH}/eaapi.jar</systemPath>
<!-- systemPath>C:\Program Files (x86)\Sparx Systems\EA\Java API\eaapi.jar</systemPath -->
<version>1.0.0</version>
</dependency>

<!-- https://mvnrepository.com/artifact/org.json/json -->
Expand All @@ -237,7 +233,7 @@
<artifactId>json</artifactId>
<version>20231013</version>
</dependency>

<!-- https://mvnrepository.com/artifact/de.odysseus.staxon/staxon -->
<dependency>
<groupId>de.odysseus.staxon</groupId>
Expand Down Expand Up @@ -410,22 +406,55 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.1</version>
<version>3.5.1</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<!--
<finalName>Imvertor-1-SNAPSHOT-jar-with-dependencies</finalName>
-->
<minimizeJar>true</minimizeJar>
<transformers>
<transformer implementation="org.apache.maven.plugins.shade.resource.ManifestResourceTransformer">
<mainClass>nl.imvertor.ChainTranslateAndReport</mainClass>
</transformer>
<transformer implementation="org.apache.maven.plugins.shade.resource.ServicesResourceTransformer"/>
</transformers>
<filters>
<filter>
<artifact>org.eclipse.birt.runtime.3_7_1:org.apache.xerces</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>com.fasterxml.woodstox:woodstox-core</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>org.codehaus.woodstox:woodstox-core-asl</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>commons-jxpath:commons-jxpath</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>log4j:log4j</artifact>
<includes>
<include>**</include>
</includes>
</filter>
<filter>
<artifact>*:*</artifact>
<excludes>
Expand All @@ -440,8 +469,40 @@
</executions>
</plugin>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-install-plugin</artifactId>
<version>3.1.1</version>
<executions>
<execution>
<id>install-external</id>
<phase>clean</phase>
<configuration>
<file>${basedir}/lib/eaapi.jar</file>
<repositoryLayout>default</repositoryLayout>
<groupId>enterprise.architect</groupId>
<artifactId>java-api</artifactId>
<version>1.0.0</version>
<packaging>jar</packaging>
<generatePom>true</generatePom>
</configuration>
<goals>
<goal>install-file</goal>
</goals>
</execution>
</executions>
</plugin>

</plugins>
</build>

<distributionManagement>
<repository>
<id>github</id>
<name>GitHub Packages</name>
<url>https://maven.pkg.github.com/imvertor/imvertor-maven</url>
</repository>
</distributionManagement>

<url>http://www.imvertor.org/</url>
</project>

0 comments on commit a14f04a

Please sign in to comment.