From 75686ea081ab693e2c40159ce779005b43f6fedc Mon Sep 17 00:00:00 2001 From: Marcus Da Coregio Date: Wed, 15 Feb 2023 15:03:14 -0300 Subject: [PATCH] Update deploy-docs.yml Issue gh-2234 --- .github/workflows/deploy-docs.yml | 44 ++++++++++++++++++------------- 1 file changed, 26 insertions(+), 18 deletions(-) diff --git a/.github/workflows/deploy-docs.yml b/.github/workflows/deploy-docs.yml index a91c7466..95bcc014 100644 --- a/.github/workflows/deploy-docs.yml +++ b/.github/workflows/deploy-docs.yml @@ -1,29 +1,37 @@ name: Deploy Docs +run-name: ${{ format('{0} ({1})', github.workflow, github.event.inputs.build-refname || 'all') }} on: workflow_dispatch: + inputs: + build-refname: + description: Enter git refname to build (e.g., 2.7.x). + required: false push: branches: docs-build +env: + GRADLE_ENTERPRISE_SECRET_ACCESS_KEY: ${{ secrets.GRADLE_ENTERPRISE_SECRET_ACCESS_KEY }} permissions: read-all jobs: build: if: github.repository_owner == 'spring-projects' runs-on: ubuntu-latest steps: - - name: Checkout - uses: actions/checkout@v2 - with: - fetch-depth: 5 - - name: Set Up Gradle - uses: spring-io/spring-gradle-build-action@v1 - with: - java-version: '17' - distribution: temurin - - name: Scrub Gradle Cache - # Remove some files from the Gradle cache, so they aren't cached by GitHub Actions. - # Restoring these files from a GitHub Actions cache might cause problems for future builds. - run: | - rm -rf /home/runner/.gradle/ - - name: Run Antora - run: ./gradlew antora - - name: Publish Docs - run: ${GITHUB_WORKSPACE}/.github/actions/publish-docs.sh "${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }}" /opt/www/domains/spring.io/docs/htdocs/spring-session/reference/ "${{ secrets.DOCS_SSH_KEY }}" "${{ secrets.DOCS_SSH_HOST_KEY }}" + - name: Checkout + uses: actions/checkout@v3 + with: + fetch-depth: 5 + - name: Set Up Gradle + uses: spring-io/spring-gradle-build-action@v2 + with: + java-version: '17' + distribution: temurin + - name: Set up refname build + if: github.event.inputs.build-refname + run: | + git fetch --depth 1 https://github.com/$GITHUB_REPOSITORY ${{ github.event.inputs.build-refname }} + echo BUILD_REFNAME=${{ github.event.inputs.build-refname }} >> $GITHUB_ENV + echo BUILD_VERSION=$(git cat-file --textconv FETCH_HEAD:gradle.properties | sed -n '/^version=/ { s/^version=//;p }') >> $GITHUB_ENV + - name: Run Antora + run: ./gradlew antora + - name: Publish Docs + run: $GITHUB_WORKSPACE/.github/actions/publish-docs.sh "${{ secrets.DOCS_USERNAME }}@${{ secrets.DOCS_HOST }}" /opt/www/domains/spring.io/docs/htdocs/spring-session/reference/ "${{ secrets.DOCS_SSH_KEY }}" "${{ secrets.DOCS_SSH_HOST_KEY }}" "${{ secrets.CLOUDFLARE_ZONE_ID }}" "${{ secrets.CLOUDFLARE_CACHE_TOKEN }}"