Skip to content

.github/workflows/publish.yml #52

.github/workflows/publish.yml

.github/workflows/publish.yml #52

Workflow file for this run

on:
push:
branches: [ "sovity/**" ]
release:
types: [ published ]
pull_request:
branches: [ "sovity/**" ]
jobs:
build-gradle-project:
name: Build Gradle Project
runs-on: ubuntu-latest
timeout-minutes: 360
permissions:
contents: read
packages: write
steps:
- uses: actions/checkout@v3
- uses: ./.github/actions/setup-build
- uses: ./.github/actions/run-tests
- name: Debug
run: echo ${{ github.ref }} ; echo ${GITHUB_REF}
- name: Check
run: ./gradlew check
- name: "Gradle: Publish"
if: ${{ startsWith(github.ref, 'refs/tags/v') || startsWith(github.ref, 'refs/heads/sovity/') }}
run: |
if [[ "$GITHUB_REF" == "refs/tags/v"* ]]; then
GRADLE_ARGS="-Pversion=${GITHUB_REF#refs/tags/v}"
elif [[ "$GITHUB_REF" == "refs/heads/sovity/"* ]]; then
GRADLE_ARGS="-Pversion=${GITHUB_REF#refs/heads/sovity/}.0.$(date '+%Y%m%d.%H%M%S')"
elif [[ "$GITHUB_REF" == "refs/pull/"* ]]; then
GRADLE_ARGS="-Pversion=0.PR-$(echo $GITHUB_REF | cut -d '/' -f 3)"
fi
./gradlew --info -D'org.gradle.internal.http.socketTimeout=60000' -D'org.gradle.internal.http.connectionTimeout=60000' --no-parallel "$GRADLE_ARGS" publishAllPublicationsToGitHubPackagesRepository
env:
USERNAME: ${{ github.actor }}
TOKEN: ${{ secrets.GITHUB_TOKEN }}