From 2787bd5fa48e1b57c38267fe89caabf8941aab05 Mon Sep 17 00:00:00 2001 From: Tobias Roeser Date: Mon, 4 Mar 2024 17:57:46 +0100 Subject: [PATCH] CI: only publish anything when tests are successful --- .github/workflows/actions.yml | 22 ++++++++++++++++++++++ .github/workflows/publishDocs.yml | 11 ++++++++--- .github/workflows/publishExecutable.yml | 13 +++++++++---- .github/workflows/release.yml | 21 ++++++++++++++++----- 4 files changed, 55 insertions(+), 12 deletions(-) diff --git a/.github/workflows/actions.yml b/.github/workflows/actions.yml index c621d3279..2d77ab588 100644 --- a/.github/workflows/actions.yml +++ b/.github/workflows/actions.yml @@ -28,6 +28,7 @@ jobs: with: java-version: ${{ matrix.java-version }} - run: ./mill -i unitTest "${{ matrix.scala-binary-version }}" + itest: strategy: fail-fast: false @@ -43,6 +44,7 @@ jobs: with: java-version: ${{ matrix.java-version }} - run: ./mill -i integrationTest ${{ matrix.scala-version }} + publishLocal: strategy: fail-fast: false @@ -57,3 +59,23 @@ jobs: with: java-version: 8 - run: ./mill -i __[${{ matrix.scala-version }}].__.publishLocal + + release: + if: github.repository == 'com-lihaoyi/Ammonite' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.x') + needs: [ test, itest, publishLocal ] + uses: ./.github/workflows/release.yml + secrets: inherit + + publishDosc: + if: github.repository == 'com-lihaoyi/Ammonite' && github.ref == 'refs/heads/main' + needs: [ test, itest ] + uses: ./.github/workflows/publishDocs.yml + secrets: + DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }} + + publishExecutable: + if: github.repository == 'com-lihaoyi/Ammonite' && (github.ref == 'refs/heads/main' || github.ref == 'refs/heads/2.x') + needs: [ test, itest ] + uses: ./.github/workflows/publishDocs.yml + secrets: + AMMONITE_BOT_AUTH_TOKEN: ${{ secrets.AMMONITE_BOT_AUTH_TOKEN }} diff --git a/.github/workflows/publishDocs.yml b/.github/workflows/publishDocs.yml index 853734fac..d8b47982e 100644 --- a/.github/workflows/publishDocs.yml +++ b/.github/workflows/publishDocs.yml @@ -1,8 +1,13 @@ name: Publish Docs on: - push: - branches: - - main +# push: +# branches: +# - main + workflow_call: + secrets: + DEPLOY_KEY: + required: true + jobs: publishDocs: runs-on: ubuntu-latest diff --git a/.github/workflows/publishExecutable.yml b/.github/workflows/publishExecutable.yml index b0e39ef66..d37b793c3 100644 --- a/.github/workflows/publishExecutable.yml +++ b/.github/workflows/publishExecutable.yml @@ -1,9 +1,14 @@ name: Publish Executable on: - push: - branches: - - main - - 2.x +# push: +# branches: +# - main +# - 2.x + workflow_call: + secrets: + AMMONITE_BOT_AUTH_TOKEN: + required: true + jobs: publishExecutable: runs-on: ubuntu-latest diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index d9832bc64..3d0f35be7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,14 +1,25 @@ name: Release on: - push: - branches: - - main - - 2.x + # push: + # branches: + # - main + # - 2.x + workflow_call: + secrets: + SONATYPE_PGP_SECRET: + required: true + SONATYPE_DEPLOY_USER: + required: true + SONATYPE_DEPLOY_PASSWORD: + required: true + SONATYPE_PGP_PASSWORD: + required: true + jobs: release: strategy: matrix: - shard: [1, 2, 3, 4, 5] + shard: [ 1, 2, 3, 4, 5 ] fail-fast: false runs-on: ubuntu-latest env: