From 4454b72e8cfab193d58e38882ba47279d7832b3f Mon Sep 17 00:00:00 2001 From: Maciej Kucharczyk Date: Sun, 3 Nov 2024 12:24:46 +0100 Subject: [PATCH] Improve workflow --- .github/workflows/maven.yml | 5 +- .github/workflows/release.yml | 100 ++++++++++++++++++++++++++++++++++ 2 files changed, 103 insertions(+), 2 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/maven.yml b/.github/workflows/maven.yml index a96d683..64fe8bc 100644 --- a/.github/workflows/maven.yml +++ b/.github/workflows/maven.yml @@ -2,9 +2,10 @@ name: Java CI with Maven on: push: - branches: [ "main" ] + branches: [ "main", "release-workflow" ] pull_request: branches: [ "main" ] + workflow_call: jobs: build: @@ -51,7 +52,7 @@ jobs: path: jgpio/target test-it: - needs: build + needs: [build] runs-on: self-hosted steps: - uses: actions/checkout@v4 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..1d2f9e5 --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,100 @@ +name: Release + +on: + push: + branches: [ "release-workflow" ] + workflow_dispatch: + inputs: + version: + description: 'Release version' + required: true + nextVersion: + description: 'Next version after release (-SNAPSHOT will be added automatically)' + required: true + +jobs: + build: + + runs-on: ubuntu-latest + + steps: + - uses: actions/checkout@v4 + + - name: Set up JDK 23 + uses: actions/setup-java@v4 + with: + java-version: '23' + distribution: 'temurin' + cache: maven + + - name: Set release version +#${{ github.event.inputs.version }} + run: | + mvn -B -ntp -f jgpio/pom.xml versions:set -DnewVersion=1.2.5 + mvn -B -ntp -f jgpio-it/pom.xml versions:set -DnewVersion=1.2.5 + mvn -B -ntp -f examples/pom.xml versions:set-property -Dproperty=jgpio.version -DnewVersion=1.2.5 + sed -i '//s/>.*1.2.5