diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a06c6e1..5890f5c 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -37,8 +37,7 @@ jobs: - name: Gradle Wrapper Validation uses: gradle/actions/wrapper-validation@v3 - - - name: Test on Ubuntu + - name: Run Checks run: ./gradlew assemble check --no-build-cache --no-daemon --stacktrace # Deploy to Github Pages @@ -47,8 +46,6 @@ jobs: name: github-pages url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest - needs: - - test-ubuntu if: github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' steps: - name: Checkout @@ -62,7 +59,6 @@ jobs: check-latest: true - name: Run Invert on Test Projects and Generate GitHub Pages -# run: cd examples && ./gradlew :invert && cd .. run: ./scripts/github-pages.main.kts - name: Setup Pages @@ -72,18 +68,34 @@ jobs: uses: actions/upload-pages-artifact@v2 with: # Upload the generated pages -# path: './examples/build/reports/invert' path: './build/static' - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v2 + publish-check: + runs-on: ubuntu-latest + if: github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + outputs: + is_snapshot: ${{ steps.check.outputs.is_snapshot }} + steps: + - name: Retrieve Version from gradle.properties + run: echo "VERSION_NAME=$(cat gradle.properties | grep "^version=" | awk -F'=' '{print $2}')" >> $GITHUB_ENV + + - name: Set up environment variable + run: | + if [[ "${VERSION_NAME}" == *-SNAPSHOT ]]; then + echo "::set-output name=is_snapshot::true" + else + echo "::set-output name=is_snapshot::false" + fi + publish-snapshot: needs: - - test-ubuntu + - publish-check runs-on: ubuntu-latest - if: github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + if: needs.check-snapshot.outputs.is_snapshot == 'true' timeout-minutes: 25 steps: @@ -100,23 +112,18 @@ jobs: - name: Gradle Wrapper Validation uses: gradle/actions/wrapper-validation@v3 - - name: Retrieve Version from gradle.properties - run: echo "VERSION_NAME=$(cat gradle.properties | grep "^version=" | awk -F'=' '{print $2}')" >> $GITHUB_ENV - - - name: Publish Snapshot - run: ./gradlew :invert-models:publish :invert-gradle-plugin:publish --no-configuration-cache --stacktrace - if: success() && endsWith(env.VERSION_NAME, '-SNAPSHOT') - env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} - +# - name: Publish Snapshot +# run: ./gradlew :invert-models:publish :invert-gradle-plugin:publish --no-configuration-cache --stacktrace +# if: success() && endsWith(env.VERSION_NAME, '-SNAPSHOT') +# env: +# ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} +# ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} publish-release: -# Temporary to help debug publishing of 0.0.1-dev -# needs: -# - test-ubuntu + needs: + - publish-check runs-on: ubuntu-latest - if: github.repository == 'square/invert' && github.ref == 'refs/heads/main' && github.event_name != 'pull_request' + if: needs.check-snapshot.outputs.is_snapshot == 'false' timeout-minutes: 25 steps: @@ -133,13 +140,10 @@ jobs: - name: Gradle Wrapper Validation uses: gradle/actions/wrapper-validation@v3 - - name: Retrieve Version from gradle.properties - run: echo "VERSION_NAME=$(cat gradle.properties | grep "^version=" | awk -F'=' '{print $2}')" >> $GITHUB_ENV - - - name: Publish release (main only) - run: ./gradlew publishToMavenCentral --no-configuration-cache --stacktrace --no-parallel - if: success() && !endsWith(env.VERSION_NAME, '-SNAPSHOT') - env: - ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} - ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} - ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }} +# - name: Publish release (main only) +# run: ./gradlew publishToMavenCentral --no-configuration-cache --stacktrace --no-parallel +# if: success() && !endsWith(env.VERSION_NAME, '-SNAPSHOT') +# env: +# ORG_GRADLE_PROJECT_mavenCentralUsername: ${{ secrets.SONATYPE_NEXUS_USERNAME }} +# ORG_GRADLE_PROJECT_mavenCentralPassword: ${{ secrets.SONATYPE_NEXUS_PASSWORD }} +# ORG_GRADLE_PROJECT_signingInMemoryKey: ${{ secrets.ARTIFACT_SIGNING_PRIVATE_KEY }}