NBM CI with Maven #4
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
# This workflow will build a Java project with Maven, and cache/restore any dependencies to improve the workflow execution time | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-maven | |
# This workflow uses actions that are not certified by GitHub. | |
# They are provided by a third-party and are governed by | |
# separate terms of service, privacy policy, and support | |
# documentation. | |
name: NBM CI with Maven | |
#on: | |
# push: | |
# branches: [ "master" ] | |
# pull_request: | |
# branches: [ "master" ] | |
on: | |
workflow_dispatch: | |
# Inputs the workflow accepts. | |
#inputs: | |
#name: | |
# Friendly description to be shown in the UI instead of 'name' | |
#description: 'Person to greet' | |
# Default value if no value is explicitly provided | |
#default: 'World' | |
# Input has to be provided for the workflow to run | |
#required: false | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
permissions: write-all | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 8 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '8' | |
distribution: 'temurin' | |
cache: maven | |
#Maven Publish to Github | |
#server-id: github # Value of the distributionManagement/repository/id field of the pom.xml | |
#settings-path: ${{ github.workspace }} # location for the settings.xml file | |
#Maven Publish to Central | |
server-id: ossrh | |
server-username: MAVEN_USERNAME | |
server-password: MAVEN_PASSWORD | |
gpg-private-key: ${{ secrets.OSSRH_GPG_SECRET_KEY }} | |
gpg-passphrase: MAVEN_GPG_PASSPHRASE | |
#TODO | |
- name: Get Next Version | |
run: | | |
echo "RELEASE_VERSION=$(mvn help:evaluate -Dproject.version=next.version -Dexpression=next.version -q -DforceStdout)" >> $GITHUB_ENV | |
echo "RELEASE_DAY=$(date +%d)" >> $GITHUB_ENV | |
echo "RELEASE_MONTH=$(date +%m)" >> $GITHUB_ENV | |
echo "RELEASE_YEAR=$(date +%y)" >> $GITHUB_ENV | |
- name: Set Spec Version | |
run: | | |
sed -i "s/OpenIDE-Module-Specification-Version:.*/OpenIDE-Module-Specification-Version: ${{ env.RELEASE_VERSION }}/" src/main/nbm/manifest.mf | |
- name: Build NBM | |
run: | | |
mvn -B clean deploy -Dnext.version=${{ env.RELEASE_VERSION }} | |
echo "SIZE=$(wc -c target/nbm/fastsearch-${{ env.RELEASE_VERSION }}.nbm | awk '{print $1}')" >> $GITHUB_ENV | |
env: | |
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }} | |
MAVEN_GPG_PASSPHRASE: ${{ secrets.OSSRH_GPG_SECRET_KEY_PASSWORD }} | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Create Release | |
uses: actions/create-release@v1 | |
id: create_release | |
with: | |
draft: false | |
prerelease: false | |
release_name: ${{ github.event.repository.name }} ${{ env.RELEASE_VERSION }} | |
tag_name: ${{ env.RELEASE_VERSION }} | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
- name: Attach NBM | |
uses: actions/upload-release-asset@v1 | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: target/nbm/fastsearch-${{ env.RELEASE_VERSION }}.nbm | |
asset_name: fastsearch-${{ env.RELEASE_VERSION }}.nbm | |
asset_content_type: application/gzip | |
env: | |
GITHUB_TOKEN: ${{ github.token }} | |
#- name: Publish to GitHub Packages Apache Maven | |
# run: mvn deploy -s $GITHUB_WORKSPACE/settings.xml | |
# env: | |
# GITHUB_TOKEN: ${{ github.token }} | |
# Optional: Uploads the full dependency graph to GitHub to improve the quality of Dependabot alerts this repository can receive | |
#- name: Update dependency graph | |
# uses: advanced-security/maven-dependency-submission-action@571e99aab1055c2e71a1e2309b9691de18d6b7d6 |