Skip to content

Commit

Permalink
Improve workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mk868 committed Nov 4, 2024
1 parent 2fb0c69 commit 081630c
Show file tree
Hide file tree
Showing 2 changed files with 94 additions and 5 deletions.
37 changes: 32 additions & 5 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Java CI with Maven

on:
push:
branches: [ "main" ]
branches: [ "main", "release-workflow" ]
pull_request:
branches: [ "main" ]

Expand Down Expand Up @@ -34,14 +34,41 @@ jobs:

- name: Check sources with Maven
run: |
mvn -B --file jgpio/pom.xml license:check
mvn -B -f jgpio/pom.xml license:check
# TODO check formatting

- name: Build with Maven
run: |
./prepare.sh
mvn -B install --file jgpio/pom.xml -Djextract.bin=../jextract/bin/jextract
mvn -B install -f jgpio/pom.xml -Djextract.bin=../jextract/bin/jextract
- name: Build IT with Maven
run: mvn -B package --file jgpio-it/pom.xml
# TODO run IT on remote Orange Pi One Plus
run: mvn -B package -f jgpio-it/pom.xml

- uses: actions/upload-artifact@v4
with:
name: jgpio-target
path: jgpio/target

test-it:
needs: [build]
runs-on: self-hosted
steps:
- uses: actions/checkout@v4

- name: Set up JDK 23
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'temurin'
cache: maven

- uses: actions/download-artifact@v4
with:
name: jgpio-target
path: jgpio/target

- name: Test IT
run: |
mvn -B jar:jar install:install -f jgpio/pom.xml
mvn -B verify -f jgpio-it/pom.xml
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
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 '/<version>/s/>.*</>1.2.5</' README.md
# git add -u
# git commit -m "Release 1.2.5"
# git tag "v1.2.5"

- name: Build and test
# uses: ./.github/workflows/maven.yml
uses: mk868/lib-jgpio/.github/workflows/maven.yml@release-workflow

- name: Deploy with Maven
run: |
./prepare.sh
mvn -B deploy -P release -f jgpio/pom.xml -Djextract.bin=../jextract/bin/jextract
- name: Set SNAPSHOT version
#${{ github.event.inputs.nextVersion }}
run: |
mvn -B -ntp -f jgpio/pom.xml versions:set -DnewVersion=1.3.0-SNAPSHOT
mvn -B -ntp -f jgpio-it/pom.xml versions:set -DnewVersion=1.3.0-SNAPSHOT
git add -u
git commit -m "Bump version to 1.3.0-SNAPSHOT"
# - name: Commit & Push changes
# uses: actions-js/push@master
# with:
# github_token: ${{ secrets.RELEASE_GITHUB_TOKEN }}
# tags: true

0 comments on commit 081630c

Please sign in to comment.