Skip to content

Commit

Permalink
(chore) ci: publish only after all builds
Browse files Browse the repository at this point in the history
  • Loading branch information
alexey-pelykh committed Jun 19, 2024
1 parent c53058b commit 17a290a
Showing 1 changed file with 31 additions and 7 deletions.
38 changes: 31 additions & 7 deletions .github/workflows/push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,6 @@ jobs:

runs-on: ${{ matrix.os }}

permissions:
contents: read
packages: write

steps:
- name: Checkout code
uses: actions/checkout@v4
Expand All @@ -54,14 +50,42 @@ jobs:

- name: Build with Gradle (Ubuntu)
if: ${{ matrix.os == 'ubuntu-latest' }}
run: ./gradlew build -Dpcre4j.version=main-SNAPSHOT -Dpcre2.library.path=/usr/lib/x86_64-linux-gnu
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: Publish
- 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: Checkout code
uses: actions/checkout@v4

- 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
run: ./gradlew publishAllPublicationsToGitHubPackagesRepository -Dpcre4j.version=main-SNAPSHOT

0 comments on commit 17a290a

Please sign in to comment.