37
37
- name : Gradle Wrapper Validation
38
38
uses : gradle/actions/wrapper-validation@v3
39
39
40
-
41
- - name : Test on Ubuntu
40
+ - name : Run Checks
42
41
run : ./gradlew assemble check --no-build-cache --no-daemon --stacktrace
43
42
44
43
# Deploy to Github Pages
47
46
name : github-pages
48
47
url : ${{ steps.deployment.outputs.page_url }}
49
48
runs-on : ubuntu-latest
50
- needs :
51
- - test-ubuntu
52
49
if : github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
53
50
steps :
54
51
- name : Checkout
62
59
check-latest : true
63
60
64
61
- name : Run Invert on Test Projects and Generate GitHub Pages
65
- # run: cd examples && ./gradlew :invert && cd ..
66
62
run : ./scripts/github-pages.main.kts
67
63
68
64
- name : Setup Pages
@@ -72,18 +68,34 @@ jobs:
72
68
uses : actions/upload-pages-artifact@v2
73
69
with :
74
70
# Upload the generated pages
75
- # path: './examples/build/reports/invert'
76
71
path : ' ./build/static'
77
72
78
73
- name : Deploy to GitHub Pages
79
74
id : deployment
80
75
uses : actions/deploy-pages@v2
81
76
77
+ publish-check :
78
+ runs-on : ubuntu-latest
79
+ if : github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
80
+ outputs :
81
+ is_snapshot : ${{ steps.check.outputs.is_snapshot }}
82
+ steps :
83
+ - name : Retrieve Version from gradle.properties
84
+ run : echo "VERSION_NAME=$(cat gradle.properties | grep "^version=" | awk -F'=' '{print $2}')" >> $GITHUB_ENV
85
+
86
+ - name : Set up environment variable
87
+ run : |
88
+ if [[ "${VERSION_NAME}" == *-SNAPSHOT ]]; then
89
+ echo "::set-output name=is_snapshot::true"
90
+ else
91
+ echo "::set-output name=is_snapshot::false"
92
+ fi
93
+
82
94
publish-snapshot :
83
95
needs :
84
- - test-ubuntu
96
+ - should-publish-check
85
97
runs-on : ubuntu-latest
86
- if : github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request '
98
+ if : needs.check-snapshot.outputs.is_snapshot == 'true '
87
99
timeout-minutes : 25
88
100
89
101
steps :
@@ -100,23 +112,18 @@ jobs:
100
112
- name : Gradle Wrapper Validation
101
113
uses : gradle/actions/wrapper-validation@v3
102
114
103
- - name : Retrieve Version from gradle.properties
104
- run : echo "VERSION_NAME=$(cat gradle.properties | grep "^version=" | awk -F'=' '{print $2}')" >> $GITHUB_ENV
105
-
106
- - name : Publish Snapshot
107
- run : ./gradlew :invert-models:publish :invert-gradle-plugin:publish --no-configuration-cache --stacktrace
108
- if : success() && endsWith(env.VERSION_NAME, '-SNAPSHOT')
109
- env :
110
- ORG_GRADLE_PROJECT_mavenCentralUsername : ${{ secrets.SONATYPE_NEXUS_USERNAME }}
111
- ORG_GRADLE_PROJECT_mavenCentralPassword : ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
112
-
115
+ # - name: Publish Snapshot
116
+ # run: ./gradlew :invert-models:publish :invert-gradle-plugin:publish --no-configuration-cache --stacktrace
117
+ # if: success() && endsWith(env.VERSION_NAME, '-SNAPSHOT')
118
+ # env:
119
+ # ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
120
+ # ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
113
121
114
122
publish-release :
115
- # Temporary to help debug publishing of 0.0.1-dev
116
- # needs:
117
- # - test-ubuntu
123
+ needs :
124
+ - publish-check
118
125
runs-on : ubuntu-latest
119
- if : github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request '
126
+ if : needs.check-snapshot.outputs.is_snapshot == 'false '
120
127
timeout-minutes : 25
121
128
122
129
steps :
@@ -133,13 +140,10 @@ jobs:
133
140
- name : Gradle Wrapper Validation
134
141
uses : gradle/actions/wrapper-validation@v3
135
142
136
- - name : Retrieve Version from gradle.properties
137
- run : echo "VERSION_NAME=$(cat gradle.properties | grep "^version=" | awk -F'=' '{print $2}')" >> $GITHUB_ENV
138
-
139
- - name : Publish release (main only)
140
- run : ./gradlew publishToMavenCentral --no-configuration-cache --stacktrace --no-parallel
141
- if : success() && !endsWith(env.VERSION_NAME, '-SNAPSHOT')
142
- env :
143
- ORG_GRADLE_PROJECT_mavenCentralUsername : ${{ secrets.SONATYPE_NEXUS_USERNAME }}
144
- ORG_GRADLE_PROJECT_mavenCentralPassword : ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
145
- ORG_GRADLE_PROJECT_signingInMemoryKey : ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}
143
+ # - name: Publish release (main only)
144
+ # run: ./gradlew publishToMavenCentral --no-configuration-cache --stacktrace --no-parallel
145
+ # if: success() && !endsWith(env.VERSION_NAME, '-SNAPSHOT')
146
+ # env:
147
+ # ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }}
148
+ # ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }}
149
+ # ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}
0 commit comments