From e95f34459da70283bc89750f89502e62095e3bda Mon Sep 17 00:00:00 2001 From: Mikhail Dzianishchyts Date: Sat, 18 May 2024 11:44:11 +0300 Subject: [PATCH] Set up release workflow --- .github/workflows/release.yml | 66 +++++++++++++++++++++++++++++++++++ pom.xml | 13 ++++--- 2 files changed, 75 insertions(+), 4 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..badc168 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,66 @@ +name: 'create release' + +on: + push: + tags: + - '[0-9]+.[0-9]+*' + +jobs: + prepare-release: + runs-on: ubuntu-latest + + outputs: + tag: ${{ steps.vars.outputs.tag }} + version: ${{ steps.vars.outputs.version }} + upload_url: ${{ steps.create_release.outputs.upload_url }} + + steps: + - name: Checkout... + uses: actions/checkout@v4 + + - name: Set version... + id: vars + run: | + RELEASE_TAG=${GITHUB_REF#refs/*/} + echo ::set-output name=tag::${RELEASE_TAG} + echo ::set-output name=version::${RELEASE_TAG:1} + + - name: Create release... + id: create_release + uses: actions/create-release@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + tag_name: ${{ steps.vars.outputs.tag }} + release_name: ${{ steps.vars.outputs.tag }} + body: JJava ${{ steps.vars.outputs.tag }} release + draft: true + prerelease: false + + build-and-upload: + needs: prepare-release + runs-on: ubuntu-latest + + steps: + - name: Checkout... + uses: actions/checkout@v4 + + - name: Set up JDK... + uses: actions/setup-java@v4 + with: + java-version: ${{ matrix.java }} + distribution: 'temurin' + cache: 'maven' + + - name: Build and test... + run: mvn clean verify -U + + - name: Upload Archive... + uses: actions/upload-release-asset@v1 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + with: + upload_url: ${{ needs.prepare-release.outputs.upload_url }} + asset_path: ./target/jjava-${{ needs.prepare-release.outputs.version }}.zip + asset_name: jjava-${{ needs.prepare-release.outputs.version }}.zip + asset_content_type: application/zip diff --git a/pom.xml b/pom.xml index c22faaf..ba02911 100644 --- a/pom.xml +++ b/pom.xml @@ -22,10 +22,10 @@ https://github.com/dflib/jjava - scm:git:https://github.com/dflib/jjava - scm:git:ssh://git@github.com/dflib/jjava - https://github.com/dflib/jjava - HEAD + scm:git:https://github.com/m-dzianishchyts/jjava + scm:git:ssh://git@github.com/m-dzianishchyts/jjava + https://github.com/m-dzianishchyts/jjava + ${project.version} @@ -133,6 +133,11 @@ + + org.apache.maven.plugins + maven-release-plugin + 3.0.1 +