5
5
tags :
6
6
- ' [0-9]+.[0-9]+.[0-9]+*'
7
7
workflow_dispatch :
8
+ # Test this workflow in PRs in case it changed
9
+ pull_request :
10
+ paths :
11
+ - .github/workflows/publish.yml
8
12
9
13
jobs :
10
14
newRelease :
26
30
java-version : ' 11'
27
31
- name : Set up Gradle
28
32
uses : gradle/gradle-build-action@v2
29
- - name : Use tag as version
30
- run : echo "${GITHUB_REF#refs/*/}" > version.txt
33
+ - name : Configure the project version
34
+ env :
35
+ IS_PR : ${{ github.event_name == 'pull_request' }}
36
+ run : |-
37
+ if [[ "$IS_PR" = 'true' ]]; then
38
+ echo "0.0.1-SNAPSHOT" > version.txt
39
+ else
40
+ echo "${GITHUB_REF#refs/*/}" > version.txt
41
+ fi
42
+ cat version.txt
31
43
# Perform the build in a separate call to avoid trying to publish
32
44
# something where the build already failed partially. This could happen
33
45
# due to the use of the --continue flag in the publish step.
@@ -46,27 +58,36 @@ jobs:
46
58
# Usually, the artifact that cannot be uploaded is strangely already
47
59
# in the repo. As the result, by ignoring the exception, we should end
48
60
# up with a working release in most cases.
49
- run : >-
50
- ./gradlew --build-cache publish
51
- --continue
52
- --info
53
- -PciBuild=true
54
- -Partifacts.itemis.cloud.user=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_USER }}
55
- -Partifacts.itemis.cloud.pw=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_PW }}
56
- -Pgpr.user=${{ github.actor }}
57
- -Pgpr.key=${{ secrets.GITHUB_TOKEN }}
58
- -Pgpr.universalkey=${{ secrets.GHP_UNIVERSAL_PUBLISH_TOKEN }}
59
- -Porg.gradle.internal.http.connectionTimeout=180000
60
- -Porg.gradle.internal.http.socketTimeout=180000
61
+ run : |-
62
+ if [[ "$IS_PR" = 'true' ]]; then
63
+ TARGET=publishToMavenLocal
64
+ else
65
+ TARGET=publish
66
+ fi
67
+ ./gradlew --build-cache $TARGET \
68
+ --continue \
69
+ --info \
70
+ -PciBuild=true \
71
+ -Partifacts.itemis.cloud.user=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_USER }} \
72
+ -Partifacts.itemis.cloud.pw=${{ secrets.ARTIFACTS_ITEMIS_CLOUD_PW }} \
73
+ -Pgpr.user=${{ github.actor }} \
74
+ -Pgpr.key=${{ secrets.GITHUB_TOKEN }} \
75
+ -Pgpr.universalkey=${{ secrets.GHP_UNIVERSAL_PUBLISH_TOKEN }} \
76
+ -Porg.gradle.internal.http.connectionTimeout=180000 \
77
+ -Porg.gradle.internal.http.socketTimeout=180000
61
78
env :
62
79
NODE_AUTH_TOKEN : ${{ secrets.ARTIFACTS_ITEMIS_CLOUD_NPM_TOKEN }}
80
+ IS_PR : ${{ github.event_name == 'pull_request' }}
63
81
- name : Set up QEMU
64
82
uses : docker/setup-qemu-action@v2
65
83
- name : Set up Docker Buildx
66
84
uses : docker/setup-buildx-action@v2
67
85
with :
68
86
platforms : linux/amd64,linux/arm64
69
87
- name : Build and Publish Docker
88
+ # As publishing is currently baked into the scripts, we can't test this
89
+ # in PRs
90
+ if : ${{ github.event_name != 'pull_request' }}
70
91
env :
71
92
DOCKER_HUB_USER : ${{ secrets.DOCKER_HUB_USER }}
72
93
DOCKER_HUB_KEY : ${{ secrets.DOCKER_HUB_KEY }}
0 commit comments