Skip to content

Commit eb5ee22

Browse files
committed
Re-enable Checks
1 parent 0ac12c8 commit eb5ee22

File tree

1 file changed

+36
-32
lines changed

1 file changed

+36
-32
lines changed

.github/workflows/main.yml

Lines changed: 36 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ jobs:
3737
- name: Gradle Wrapper Validation
3838
uses: gradle/actions/wrapper-validation@v3
3939

40-
41-
- name: Test on Ubuntu
40+
- name: Run Checks
4241
run: ./gradlew assemble check --no-build-cache --no-daemon --stacktrace
4342

4443
# Deploy to Github Pages
@@ -47,8 +46,6 @@ jobs:
4746
name: github-pages
4847
url: ${{ steps.deployment.outputs.page_url }}
4948
runs-on: ubuntu-latest
50-
needs:
51-
- test-ubuntu
5249
if: github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request'
5350
steps:
5451
- name: Checkout
@@ -62,7 +59,6 @@ jobs:
6259
check-latest: true
6360

6461
- name: Run Invert on Test Projects and Generate GitHub Pages
65-
# run: cd examples && ./gradlew :invert && cd ..
6662
run: ./scripts/github-pages.main.kts
6763

6864
- name: Setup Pages
@@ -72,18 +68,34 @@ jobs:
7268
uses: actions/upload-pages-artifact@v2
7369
with:
7470
# Upload the generated pages
75-
# path: './examples/build/reports/invert'
7671
path: './build/static'
7772

7873
- name: Deploy to GitHub Pages
7974
id: deployment
8075
uses: actions/deploy-pages@v2
8176

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+
8294
publish-snapshot:
8395
needs:
84-
- test-ubuntu
96+
- should-publish-check
8597
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'
8799
timeout-minutes: 25
88100

89101
steps:
@@ -100,23 +112,18 @@ jobs:
100112
- name: Gradle Wrapper Validation
101113
uses: gradle/actions/wrapper-validation@v3
102114

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 }}
113121

114122
publish-release:
115-
# Temporary to help debug publishing of 0.0.1-dev
116-
# needs:
117-
# - test-ubuntu
123+
needs:
124+
- publish-check
118125
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'
120127
timeout-minutes: 25
121128

122129
steps:
@@ -133,13 +140,10 @@ jobs:
133140
- name: Gradle Wrapper Validation
134141
uses: gradle/actions/wrapper-validation@v3
135142

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

Comments
 (0)