-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Sanjula Ganepola <[email protected]>
- Loading branch information
1 parent
fb05cd3
commit bae555c
Showing
1 changed file
with
95 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,95 @@ | ||
name: Maven Release | ||
|
||
on: | ||
workflow_dispatch: | ||
release: | ||
types: [created] | ||
|
||
jobs: | ||
release: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
environment: OSSBUILD | ||
|
||
steps: | ||
- name: Checkout Repository | ||
uses: actions/checkout@v4 | ||
|
||
- name: Get Maven Project Version | ||
run: | | ||
echo "PROJECT_VERSION=$(mvn -q -Dexec.executable="echo" -Dexec.args='${project.version}' --non-recursive exec:exec --file pom.xml)" >> $GITHUB_ENV | ||
cat $GITHUB_ENV | ||
- name: Install GPG Secret Key | ||
id: install-secret-key | ||
run: | | ||
cat <(echo -e "${{ secrets.GPG_SECRET_KEY }}") | gpg --batch --import | ||
gpg --list-secret-keys --keyid-format LONG | ||
- name: Install GPG Public Key | ||
id: install-pulic-key | ||
run: | | ||
cat <(echo -e "${{ secrets.GPG_PUBLIC_KEY }}") | gpg --batch --import | ||
gpg --list-public-keys --keyid-format LONG | ||
- name: Set up JDK 8 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '8' | ||
distribution: 'temurin' | ||
cache: maven | ||
server-id: ossrh | ||
server-username: OSSRH_USERNAME | ||
server-password: OSSRH_TOKEN | ||
gpg-passphrase: GPG_PASSPHRASE | ||
env: | ||
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | ||
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | ||
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | ||
|
||
- name: Set Test Secrets | ||
run: | | ||
cp ${{ env.CONFIG_PROPERTIES_SAMPLE }} ${{ env.CONFIG_PROPERTIES }} | ||
sed -i 's/^IBMI_HOST=/IBMI_HOST=${{ secrets.IBMI_HOST }}/' ${{ env.CONFIG_PROPERTIES }} | ||
sed -i 's/^IBMI_USER=/IBMI_USER=${{ secrets.IBMI_USER }}/' ${{ env.CONFIG_PROPERTIES }} | ||
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: Publish Maven Package | ||
run: mvn -B clean deploy --file pom.xml | ||
|
||
- name: List Target Directory | ||
run: ls -l target | ||
|
||
- name: Copy Artifacts to Staging Directory | ||
run: mkdir staging && cp target/*.jar staging | ||
|
||
- name: Create Bundle .zip | ||
run: cd staging && zip mapapire-java-${{ env.PROJECT_VERSION }}.zip *.jar && cd .. | ||
|
||
- name: Get Release | ||
id: get_release | ||
uses: bruceadams/[email protected] | ||
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 |