docs: clarify readme #71
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
name: CI | |
on: | |
pull_request: | |
push: | |
branches-ignore: | |
- 'dependabot/**' | |
workflow_dispatch: | |
inputs: | |
perform_release: | |
description: 'Perform release' | |
default: false | |
type: boolean | |
bump: | |
description: 'Bump type' | |
required: false | |
default: 'next' | |
type: choice | |
options: | |
- 'next' | |
- 'major' | |
- 'minor' | |
- 'patch' | |
jobs: | |
test: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [ ubuntu-latest, macos-13, windows-latest ] | |
fail-fast: false | |
name: Test ${{ matrix.os }} | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up Homebrew | |
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Install libraries for Linux/Mac | |
if: contains(matrix.os, 'ubuntu') || contains(matrix.os, 'macos') | |
run: brew install libarchive | |
env: | |
HOMEBREW_NO_INSTALL_CLEANUP: 1 | |
HOMEBREW_NO_INSTALLED_DEPENDENTS_CHECK: 1 | |
- name: Setup test-libraries in path for Windows | |
if: contains(matrix.os, 'windows') | |
run: Add-Content $env:GITHUB_PATH $env:GITHUB_WORKSPACE\test-libraries\windows\x64\ | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '22' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Gradle build | |
run: ./gradlew build | |
env: | |
LD_LIBRARY_PATH: /home/linuxbrew/.linuxbrew/lib | |
JAVA_LIBRARY_PATH: /usr/local/opt/libarchive/lib | |
- name: Upload Unit Test Reports | |
if: always() | |
uses: actions/upload-artifact@v4 | |
with: | |
name: test-reports-${{ matrix.os }} | |
path: '**/build/reports/tests/' | |
version: | |
runs-on: macos-latest | |
if: github.repository_owner == 'gotson' && github.ref == 'refs/heads/main' | |
outputs: | |
version_current: ${{ steps.versions.outputs.version_current }} | |
version_next: ${{ steps.versions.outputs.version_next }} | |
should_release: ${{ steps.versions.outputs.should_release }} | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Homebrew | |
id: set-up-homebrew | |
uses: Homebrew/actions/setup-homebrew@master | |
- name: Install svu | |
run: brew install caarlos0/tap/svu | |
- name: Compute next version for release | |
if: inputs.perform_release | |
run: | | |
echo "VERSION_NEXT=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV | |
echo "VERSION_NEXT_SUFFIX=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV | |
- name: Compute next version for snapshot | |
if: inputs.perform_release != true | |
run: | | |
echo "VERSION_NEXT=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`" | tee -a $GITHUB_ENV | |
echo "VERSION_NEXT_SUFFIX=`svu --pattern="v[0-9]*" --strip-prefix ${{ inputs.bump }}`-SNAPSHOT" | tee -a $GITHUB_ENV | |
- name: Set Versions | |
id: versions | |
run: | | |
echo "version_current=`svu --pattern="v[0-9]*" --strip-prefix current`" >> $GITHUB_OUTPUT | |
echo "version_next=${{ env.VERSION_NEXT_SUFFIX }}" >> $GITHUB_OUTPUT | |
[[ `svu --pattern="v[0-9]*" --strip-prefix current` != ${{ env.VERSION_NEXT }} ]] && echo "should_release=true" >> $GITHUB_OUTPUT || echo | |
release: | |
needs: [ version, test ] | |
runs-on: ubuntu-latest | |
if: needs.version.outputs.should_release | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Display versions | |
run: | | |
echo "Current version: ${{ needs.version.outputs.version_current }}, should release: ${{ needs.version.outputs.version_next }}" | |
- name: Update version in gradle.properties | |
run: echo "version=${{ needs.version.outputs.version_next }}" > gradle.properties | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'temurin' | |
java-version: '22' | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
- name: Nexus publish | |
run: ./gradlew publishToSonatype closeAndReleaseSonatypeStagingRepository | |
env: | |
ORG_GRADLE_PROJECT_signingKey: ${{ secrets.GPG_KEY }} | |
ORG_GRADLE_PROJECT_signingPassword: ${{ secrets.GPG_PASSPHRASE }} | |
ORG_GRADLE_PROJECT_sonatypeUsername: ${{ secrets.MAVENCENTRAL_USER }} | |
ORG_GRADLE_PROJECT_sonatypePassword: ${{ secrets.MAVENCENTRAL_PASSWORD }} | |
- name: Release commit and push | |
uses: EndBug/add-and-commit@v9 | |
if: inputs.perform_release | |
with: | |
message: 'chore(release): ${{ needs.version.outputs.version_next }} [skip ci]' | |
default_author: github_actions | |
- name: JReleaser full release | |
run: ./gradlew jreleaserFullRelease | |
if: inputs.perform_release | |
env: | |
JRELEASER_GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: JReleaser Release output | |
if: always() && inputs.perform_release | |
uses: actions/upload-artifact@v4 | |
with: | |
name: jreleaser-release | |
path: | | |
build/jreleaser/trace.log | |
build/jreleaser/output.properties |