Skip to content

Commit

Permalink
tweaks for maven publish CI
Browse files Browse the repository at this point in the history
Update pom.xml

create GH release after maven publish

revert to non-snapshot version to test maven publishing
  • Loading branch information
ThePrez committed Aug 17, 2024
1 parent 08aa09e commit e8f6916
Show file tree
Hide file tree
Showing 2 changed files with 62 additions and 42 deletions.
73 changes: 47 additions & 26 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
release:
types: [created]

env:
CONFIG_PROPERTIES: ./src/test/resources/config.properties
CONFIG_PROPERTIES_SAMPLE: ./src/test/resources/config.properties.sample

jobs:
release:

Expand Down Expand Up @@ -39,7 +43,7 @@ jobs:
java-version: '8'
distribution: 'temurin'
cache: maven
server-id: ossrh
server-id: central
server-username: OSSRH_USERNAME
server-password: OSSRH_TOKEN
gpg-passphrase: GPG_PASSPHRASE
Expand All @@ -56,8 +60,17 @@ jobs:
sed -i 's/^IBMI_PASSWORD=/IBMI_PASSWORD=${{ secrets.IBMI_PASSWORD }}/' ${{ env.CONFIG_PROPERTIES }}
sed -i 's/^IBMI_PORT=/IBMI_PORT=${{ secrets.IBMI_PORT }}/' ${{ env.CONFIG_PROPERTIES }}
- name: remove test dir
run: rm -fr src/test
- name: eyeball settings.xml
run: cat $HOME/.m2/settings.xml

- name: Publish Maven Package
run: mvn -B clean deploy --file pom.xml
run: mvn --batch-mode -Dgpg.passphrase=${{ secrets.GPG_PASSPHRASE }} clean deploy --file pom.xml
env:
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }}
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }}
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }}

- name: List Target Directory
run: ls -l target
Expand All @@ -68,28 +81,36 @@ jobs:
- name: Create Bundle .zip
run: cd staging && zip mapapire-java-${{ env.PROJECT_VERSION }}.zip *.jar && cd ..

- name: Get Release
id: get_release
uses: bruceadams/get-release@v1.3.2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

- name: Upload JAR to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./mapapire-java-${{ env.PROJECT_VERSION }}.jar
asset_name: mapapire-java-${{ env.PROJECT_VERSION }}.jar
asset_content_type: application/zip

- name: Upload ZIP to Release
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# - name: Get Release
# id: get_release
# uses: bruceadams/get-release@v1.3.2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# - name: Upload JAR to Release
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.get_release.outputs.upload_url }}
# asset_path: ./mapapire-java-${{ env.PROJECT_VERSION }}.jar
# asset_name: mapapire-java-${{ env.PROJECT_VERSION }}.jar
# asset_content_type: application/zip

# - name: Upload ZIP to Release
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.get_release.outputs.upload_url }}
# asset_path: ./mapapire-java-${{ env.PROJECT_VERSION }}.zip
# asset_name: mapapire-java-${{ env.PROJECT_VERSION }}.zip
# asset_content_type: application/zip

- name: Create the tag and release
uses: softprops/action-gh-release@v1
with:
upload_url: ${{ steps.get_release.outputs.upload_url }}
asset_path: ./mapapire-java-${{ env.PROJECT_VERSION }}.zip
asset_name: mapapire-java-${{ env.PROJECT_VERSION }}.zip
asset_content_type: application/zip
tag_name: v${{ env.project_version }}
name: v${{ env.project_version }}
files: |
mapapire-java-${{ env.PROJECT_VERSION }}.zip
31 changes: 15 additions & 16 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<groupId>io.github.mapapire-ibmi</groupId>
<artifactId>mapapire-sdk</artifactId>
<version>1.0-SNAPSHOT</version>
<groupId>io.github.mapepire-ibmi</groupId>
<artifactId>mapepire-sdk</artifactId>
<version>0.0.1</version>
<packaging>jar</packaging>

<name>Mapepire Java</name>
Expand Down Expand Up @@ -41,7 +41,7 @@
<url>https://github.com/Mapepire-IBMi/mapepire-java</url>
</scm>

<distributionManagement>
<!-- <distributionManagement>
<snapshotRepository>
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/content/repositories/snapshots</url>
Expand All @@ -50,7 +50,7 @@
<id>ossrh</id>
<url>https://s01.oss.sonatype.org/service/local/staging/deploy/maven2/</url>
</repository>
</distributionManagement>
</distributionManagement> -->

<properties>
<maven.compiler.source>1.8</maven.compiler.source>
Expand Down Expand Up @@ -261,17 +261,16 @@
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.7.0</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
<nexusUrl>https://s01.oss.sonatype.org/</nexusUrl>
<autoReleaseAfterClose>true</autoReleaseAfterClose>
</configuration>
</plugin>
<plugin>
<groupId>org.sonatype.central</groupId>
<artifactId>central-publishing-maven-plugin</artifactId>
<version>0.5.0</version>
<extensions>true</extensions>
<configuration>
<publishingServerId>central</publishingServerId>
<autoPublish>true</autoPublish>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

0 comments on commit e8f6916

Please sign in to comment.