Skip to content

Commit

Permalink
ci: test the publish workflow in PRs if changed
Browse files Browse the repository at this point in the history
  • Loading branch information
languitar committed Jan 17, 2024
1 parent 560e0b1 commit 511599d
Showing 1 changed file with 18 additions and 6 deletions.
24 changes: 18 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,10 @@ on:
tags:
- '[0-9]+.[0-9]+.[0-9]+*'
workflow_dispatch:
# Test this workflow in PRs in case it changed
pull_request:
paths:
- .github/workflows/publish.yml

jobs:
newRelease:
Expand All @@ -27,15 +31,21 @@ jobs:
- name: Set up Gradle
uses: gradle/gradle-build-action@v2
- name: Use tag as version
# Set a production version only when running on tags
if: ${{ github.event_name != 'pull_request' }}
run: echo "${GITHUB_REF#refs/*/}" > version.txt
- name: Use dummy version for PR
# Set a dummy version that doesn't hurt if accidentally released
if: ${{ github.event_name == 'pull_request' }}
run: echo "0.0.1-SNAPSHOT" > version.txt
# Perform the build in a separate call to avoid trying to publish
# something where the build already failed partially. This could happen
# due to the use of the --continue flag in the publish step.
- name: Build
run: >-
./gradlew --build-cache build
--info
-PciBuild=true
# - name: Build
# run: >-
# ./gradlew --build-cache build
# --info
# -PciBuild=true
- name: Publish
# We run gradle with --info to debug the ongoing random publishing
# issues. Gradle would log upload retries on info level:
Expand All @@ -47,7 +57,8 @@ jobs:
# in the repo. As the result, by ignoring the exception, we should end
# up with a working release in most cases.
run: >-
./gradlew --build-cache publish
echo "is PR: $IS_PR"
./gradlew --build-cache $TARGET
--continue
--info
-PciBuild=true
Expand All @@ -60,6 +71,7 @@ jobs:
-Porg.gradle.internal.http.socketTimeout=180000
env:
NODE_AUTH_TOKEN: ${{ secrets.ARTIFACTS_ITEMIS_CLOUD_NPM_TOKEN }}
IS_PR: ${{ github.event_name == 'pull_request' }}
- name: Set up QEMU
uses: docker/setup-qemu-action@v2
- name: Set up Docker Buildx
Expand Down

0 comments on commit 511599d

Please sign in to comment.