Skip to content

Commit

Permalink
Feature/GitHub workflow release (#83)
Browse files Browse the repository at this point in the history
* Feature: GitHub Actions für CI #39

* Add build.xml

* Remove token for checkout, set action versions

* Use: softprops/action-gh-release

---------

Co-authored-by: dippeal <[email protected]>
  • Loading branch information
dippeal and dippeal authored Dec 1, 2023
1 parent 57f18a9 commit 6106431
Show file tree
Hide file tree
Showing 5 changed files with 360 additions and 147 deletions.
94 changes: 94 additions & 0 deletions .github/workflows/nightly-builds.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
# This workflow will build a Java project with Ant
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-ant

name: openjverein nightly release

on:
push:
branches:
- master
tags-ignore:
- '**'
pull_request:
types:
- closed

jobs:
build:
name: Building release and upload to branch

runs-on: ubuntu-latest

steps:
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
architecture: x64

- name: Check out jameica
uses: actions/checkout@v4
with:
repository: willuhn/jameica
path: jameica

- name: Build jameica nightly
working-directory: ./
run: ant -noinput -buildfile jameica/build/build.xml nightly

- name: Check out hibiscus
uses: actions/checkout@v4
with:
repository: willuhn/hibiscus
path: hibiscus

- name: Build hibiscus nightly
working-directory: ./
run: ant -noinput -buildfile hibiscus/build/build.xml nightly

- name: Checkout openjverein
id: openjverein_checkout
uses: actions/checkout@v4
with:
path: jverein

- name: Build openjverein plugin
id: openjverein
working-directory: ./
run: |
ant_output=$(ant -e -q -noinput -buildfile jverein/build/build.xml nightly)
echo $ant_output
ssa="SELECTED_VERSION="
ssb=".zip"
text="${ant_output#*${ssa}}"
text="${text%${ssb}*}.zip"
tmp_version=$(echo $text | sed -rn 's/^([^[:blank:]]*).*$/\1/p')
tmp_version=$tmp_version
ssa="SELECTED_FILENAME="
text="${ant_output#*${ssa}}"
text="${text%${ssb}*}.zip"
tmp_filename=$(echo $text | sed -rn 's/^([^[:blank:]]*).*$/\1/p')
ssa="SELECTED_PATH="
text="${ant_output#*${ssa}}"
text="${text%${ssb}*}.zip"
tmp_path=$(echo $text | sed -rn 's/^([^[:blank:]]*).*$/\1/p')
echo "selected_version=${tmp_version}" >> $GITHUB_OUTPUT
echo "selected_filename=$tmp_filename" >> $GITHUB_OUTPUT
echo "selected_path=$tmp_path" >> $GITHUB_OUTPUT
builddatetime=$(date +'%Y-%m-%d %H:%M')
echo "### Version: $tmp_version | filename: $tmp_filename | build datetime: $builddatetime" >> $GITHUB_STEP_SUMMARY
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.openjverein.outputs.selected_version }}
prerelease: true
name: Release ${{ steps.openjverein.outputs.selected_version }}
files: ./jverein/${{ steps.openjverein.outputs.selected_path }}
generate_release_notes: false
86 changes: 86 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,86 @@
# This workflow will build a Java project with Ant
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-ant

name: openjverein official release

on: workflow_dispatch

jobs:
build:
name: Building release and upload to branch

runs-on: ubuntu-latest

steps:
- name: Set up JDK 11 for x64
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
architecture: x64

- name: Check out jameica
uses: actions/checkout@v4
with:
repository: willuhn/jameica
path: jameica

- name: Build jameica nightly
working-directory: ./
run: ant -noinput -buildfile jameica/build/build.xml nightly

- name: Check out hibiscus
uses: actions/checkout@v4
with:
repository: willuhn/hibiscus
path: hibiscus

- name: Build hibiscus nightly
working-directory: ./
run: ant -noinput -buildfile hibiscus/build/build.xml nightly

- name: Checkout openjverein
id: openjverein_checkout
uses: actions/checkout@v4
with:
path: jverein

- name: Build openjverein plugin
id: openjverein
working-directory: ./
run: |
ant_output=$(ant -e -q -noinput -buildfile jverein/build/build.xml)
echo $ant_output
ssa="SELECTED_VERSION="
ssb=".zip"
text="${ant_output#*${ssa}}"
text="${text%${ssb}*}.zip"
tmp_version=$(echo $text | sed -rn 's/^([^[:blank:]]*).*$/\1/p')
tmp_version=$tmp_version
ssa="SELECTED_FILENAME="
text="${ant_output#*${ssa}}"
text="${text%${ssb}*}.zip"
tmp_filename=$(echo $text | sed -rn 's/^([^[:blank:]]*).*$/\1/p')
ssa="SELECTED_PATH="
text="${ant_output#*${ssa}}"
text="${text%${ssb}*}.zip"
tmp_path=$(echo $text | sed -rn 's/^([^[:blank:]]*).*$/\1/p')
echo "selected_version=${tmp_version}" >> $GITHUB_OUTPUT
echo "selected_filename=$tmp_filename" >> $GITHUB_OUTPUT
echo "selected_path=$tmp_path" >> $GITHUB_OUTPUT
builddatetime=$(date +'%Y-%m-%d %H:%M')
echo "### Version: $tmp_version | filename: $tmp_filename | build datetime: $builddatetime" >> $GITHUB_STEP_SUMMARY
- name: Release
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.openjverein.outputs.selected_version }}
prerelease: false
name: Release ${{ steps.openjverein.outputs.selected_version }}
files: ./jverein/${{ steps.openjverein.outputs.selected_path }}
generate_release_notes: true
7 changes: 4 additions & 3 deletions build/build.properties
Original file line number Diff line number Diff line change
Expand Up @@ -7,13 +7,14 @@ release.dir = releases
define.encoding = ISO-8859-1
define.jarfilename = ${plugin.name}.jar
define.srcfilename = ${plugin.name}.src.zip
define.srcfilename.nightly = ${plugin.name}.src-nightly.zip
define.package = de.jost_net.JVerein
define.java.version = 1.7
define.java.version = 11

project.releaseCurrent = ${release.dir}/current
project.release = ${release.dir}/${plugin_version}-${build.number}
project.release.nightly = ${release.dir}/nightly
project.tmp = ${project.release}/tmp
project.javadoc = ${project.release}/javadoc
project.zipdir = ${project.release}/${plugin.name}
project.zipfilename = ${plugin.name}.${plugin_version}.zip
project.zipfilenameCurrent = ${plugin.name}.zip
project.zipfilename.nightly = ${plugin.name}.${plugin_version}-nightly.zip
Loading

0 comments on commit 6106431

Please sign in to comment.