diff --git a/.github/workflows/publish_jar.yml b/.github/workflows/publish_jar.yml new file mode 100644 index 0000000..db515df --- /dev/null +++ b/.github/workflows/publish_jar.yml @@ -0,0 +1,41 @@ +name: Release on Tag + +on: + push: + branches: [master] + tags: + - 'release-*' + +jobs: + build-and-release: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v2 + + - name: Set up JDK 8 + uses: actions/setup-java@v2 + with: + java-version: '8' + distribution: 'adopt' + + - name: Build with Maven + run: mvn clean package + + - name: Extract Release Info + id: release_info + run: | + echo "Reading release_info.info..." + VERSION=$(awk -F= '/^VERSION=/ {print $2}' release_info.info) + DESCRIPTION=$(awk '/^DESCRIPTION=/,EOF' release_info.info | sed '1 s/DESCRIPTION=//' | sed ':a;N;$!ba;s/\n/%0A/g') + echo "::set-output name=version::${VERSION}" + echo "::set-output name=description::${DESCRIPTION}" + + - name: Create GitHub Release + uses: softprops/action-gh-release@v1 + with: + tag_name: ${{ steps.release_info.outputs.version }} + name: Release ${{ steps.release_info.outputs.version }} + body: ${{ steps.release_info.outputs.description }} + files: target/*.jar + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}