JACIS-CI-Build #248
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# JACIS Continuous Integration GITHUB workflow | |
name: JACIS-CI-Build | |
on: | |
push: | |
branches: [ master ] | |
pull_request: | |
branches: [ master ] | |
workflow_dispatch: | |
inputs: | |
release: | |
description: 'Release Build' | |
default: false | |
jobs: | |
build-and-test: | |
name: Build and Test JACIS | |
strategy: | |
fail-fast: false | |
matrix: | |
os: [windows-latest, ubuntu-latest, macos-latest] | |
java: [ 8, 11, 17] | |
runs-on: ${{ matrix.os }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Fix Permissions | |
run: chmod +x gradlew | |
- name: Setup Java ${{ matrix.java }} | |
uses: actions/setup-java@v3 | |
with: | |
java-version: ${{ matrix.java }} | |
distribution: 'temurin' | |
- name: Test | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: build --scan -Dreleasebuild=${{ github.event.inputs.release }} | |
deploy: | |
name: Deploy JACIS | |
needs: build-and-test | |
runs-on: windows-latest | |
steps: | |
- name: Check if this is a Release Build | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true' }} | |
run: echo "THIS IS A RELEASE BUILD!" | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: Setup Java 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: 17 | |
distribution: 'temurin' | |
- name: Deploy ( to https://maven.pkg.github.com/janwiemer/jacis ) | |
uses: gradle/gradle-build-action@v2 | |
with: | |
arguments: publish --scan -Dreleasebuild=${{ github.event.inputs.release }} -Dusedateversion=true -Ddeploy_user=JanWiemer -Ddeploy_pw=${{secrets.GITHUB_TOKEN}} -Ddeploy_repo_release=https://maven.pkg.github.com/janwiemer/jacis -Ddeploy_repo_snapshot=https://maven.pkg.github.com/janwiemer/jacis | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Determine Release versions | |
if: ${{ github.event.inputs.release }} == true | |
uses: HardNorth/github-version-generate@v1.3.0 | |
with: | |
version-source: file | |
version-file: gradle.properties | |
version-file-extraction-pattern: '(?<=version=).+' | |
- name: Get current time | |
uses: josStorer/get-current-time@v2 | |
id: current-time | |
with: | |
format: YYYYMMDD | |
- name: Log Release Version | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true' }} | |
run: echo "version=${{ env.RELEASE_VERSION }}" | |
- name: Log Snapshot Version | |
if: ${{ github.event_name != 'workflow_dispatch' || github.event.inputs.release != 'true' }} | |
run: echo "version=${{ env.RELEASE_VERSION }}-build${{ steps.current-time.outputs.formattedTime }}-SNAPSHOT" | |
- name: Create Release | |
if: ${{ github.event_name == 'workflow_dispatch' && github.event.inputs.release == 'true' }} | |
uses: actions/create-release@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: "v${{ env.RELEASE_VERSION }}" | |
release_name: Release ${{ env.RELEASE_VERSION }} | |
body: | | |
To use this JACIS version add the following dependency to your project: | |
<dependency> | |
<groupId>org.jacis</groupId> | |
<artifactId>jacis</artifactId> | |
<version>${{ env.RELEASE_VERSION }}</version> | |
</dependency> | |
For Gradle the dependency looks like: | |
dependencies { | |
implementation group: 'org.jacis', name: 'jacis', version: '${{ env.RELEASE_VERSION }}' | |
} | |
draft: false | |
prerelease: false |