Skip to content

ci: always run build - auto release of snapshot only from main branch #34

ci: always run build - auto release of snapshot only from main branch

ci: always run build - auto release of snapshot only from main branch #34

Workflow file for this run

name: CI
on:
push:
paths-ignore:
- '.github/workflows/release.yml'
- '**/*.md'
- 'LICENSE'
pull_request:
branches: [ "main" ]
paths-ignore:
- '.github/workflows/release.yml'
- '**/*.md'
- 'LICENSE'
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'liberica'
# Configure Gradle for optimal use in GitHub Actions, including caching of downloaded dependencies.
# See: https://github.com/gradle/actions/blob/main/setup-gradle/README.md
- name: Setup Gradle
uses: gradle/actions/setup-gradle@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0
- name: Build with Gradle Wrapper
run: ./gradlew build --s
snapshot_release:
needs: build
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
env:
ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.MAVEN_CENTRAL_USERNAME }}
ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.MAVEN_CENTRAL_PASSWORD }}
ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.SIGNING_IN_MEMORY_KEY }}
ORG_GRADLE_PROJECT_signingInMemoryKeyId: ${{ secrets.SIGNING_IN_MEMORY_KEY_ID }}
ORG_GRADLE_PROJECT_signingInMemoryKeyPassword: ${{ secrets.SIGNING_IN_MEMORY_KEY_PASSWORD }}
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Get latest tag
id: previous_tag
uses: WyriHaximus/github-action-get-previous-tag@v1
with:
fallback: 0.0.0
- name: Create snapshot version
id: version_by_fragment
uses: christian-draeger/increment-semantic-version@1.2.3
with:
current-version: ${{ steps.previous_tag.outputs.tag }}
version-fragment: minor
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'liberica'
- name: Publish package to Maven Central Repository
run: ./gradlew publishAllPublicationsToMavenCentralRepository -PVERSION_NAME=${{ steps.version_by_fragment.outputs.next-version }}-SNAPSHOT --no-configuration-cache --s
dependency-submission:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
- name: Set up JDK
uses: actions/setup-java@v4
with:
java-version: '23'
distribution: 'liberica'
# Generates and submits a dependency graph, enabling Dependabot Alerts for all project dependencies.
# See: https://github.com/gradle/actions/blob/main/dependency-submission/README.md
- name: Generate and submit dependency graph
uses: gradle/actions/dependency-submission@af1da67850ed9a4cedd57bfd976089dd991e2582 # v4.0.0