Skip to content

Commit

Permalink
Improve workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
mk868 committed Nov 5, 2024
1 parent 102452e commit 81793da
Show file tree
Hide file tree
Showing 2 changed files with 101 additions and 2 deletions.
5 changes: 3 additions & 2 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down Expand Up @@ -51,7 +52,7 @@ jobs:
path: jgpio/target

test-it:
needs: build
needs: [build]
runs-on: self-hosted
steps:
- uses: actions/checkout@v4
Expand Down
98 changes: 98 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,98 @@
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
permissions:
pull-requests: write
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: create pull request
run: gh pr create -B main -H branch_to_merge --title 'Merge branch_to_merge into main' --body 'Created by Github action'
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

# run_and_test:
# needs: prepare
# uses: ./.github/workflows/maven.yml
# - name: Set up jextract
# run: |
# ./prepare-jextract.sh
# ./prepare.sh
# mvn -B -f jgpio/pom.xml install -Djextract.bin=../jextract/bin/jextract
#
# - 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 -f jgpio/pom.xml jar:jar install:install
# mvn -B -f jgpio-it/pom.xml verify

# - 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 81793da

Please sign in to comment.