Skip to content

(chore) ci: publish only after all builds #8

(chore) ci: publish only after all builds

(chore) ci: publish only after all builds #8

Workflow file for this run

name: Push
on:
push:
branches:
- main
jobs:
build:
strategy:
matrix:
os: [ ubuntu-latest ]
java-distribution:
- temurin
- zulu
- adopt-hotspot
- adopt-openj9
- liberica
- microsoft
- corretto
- semeru
- oracle
- dragonwell
fail-fast: false
runs-on: ${{ matrix.os }}
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up "${{ matrix.java-distribution }}" JDK 21
uses: actions/setup-java@v4
with:
distribution: ${{ matrix.java-distribution }}
java-version: 21
- name: Cache Gradle packages
uses: actions/cache@v4
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }}
restore-keys: gradle-${{ runner.os }}
- name: Install PCRE (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: sudo apt-get install -y libpcre2-8-0
- name: Build with Gradle (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: ./gradlew build -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu
- name: Run tests (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: ./gradlew test -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu
- name: Upload artifacts
uses: actions/upload-artifact@v4
if: ${{ matrix.os == 'ubuntu-latest' && matrix.java-distribution == 'temurin' }}
with:
path: ./*/build/libs/*.jar
publish:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
needs:
- build
steps:
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 21
- name: Download artifacts
uses: actions/download-artifact@v4
- name: Publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: ./gradlew publishAllPublicationsToGitHubPackagesRepository -Dpcre4j.version=main-SNAPSHOT