Skip to content

Add rebuild support for VersionInfo related structures #60

Add rebuild support for VersionInfo related structures

Add rebuild support for VersionInfo related structures #60

name: Build
on: [push, pull_request]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [8, 11, 17, 18, 19, 20]
name: Java ${{ matrix.java }} build
steps:
- uses: actions/checkout@v2
- name: Setup java
uses: actions/setup-java@v1
with:
java-version: ${{ matrix.java }}
- name: Build
run: mvn -B package
- name: Test
run: mvn -B test
publish:
runs-on: ubuntu-latest
if: startsWith(github.event.ref, 'refs/tags')
name: Publish
needs:
- build
steps:
- uses: actions/checkout@v2
- name: Import GPG key
run: |
sudo apt-get install -y gpg
echo "${{ secrets.GPG_KEY }}" | gpg --import --batch --yes
- name: Get version
id: get_version
run: echo ::set-output name=VERSION::$(echo $GITHUB_REF | cut -d / -f 3)
- uses: actions/setup-java@v1
with:
java-version: 11
server-id: ossrh
server-username: MAVEN_USERNAME
server-password: MAVEN_PASSWORD
- name: Publish package
run: |
mvn -B versions:set -DnewVersion=${{ steps.get_version.outputs.VERSION }}
mvn -B -Dmaven.compiler.useIncrementalCompilation=false javadoc:jar source:jar package gpg:sign deploy -Dgpg.passphrase=${{ secrets.GPG_PASSWORD }}
env:
MAVEN_USERNAME: ${{ secrets.OSSRH_USERNAME }}
MAVEN_PASSWORD: ${{ secrets.OSSRH_TOKEN }}
- name: Create Release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ steps.get_version.outputs.VERSION }}
release_name: Release ${{ steps.get_version.outputs.VERSION }}
body: "" # TODO get git commit messages here automatically
draft: true
prerelease: false
- name: Upload Release Asset
id: upload-release-asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }}
asset_path: ./target/pecoff4j-${{ steps.get_version.outputs.VERSION }}.jar
asset_name: pecoff4j-${{ steps.get_version.outputs.VERSION }}.jar
asset_content_type: application/java-archive