Преглед на файлове

trigger partial docs build on push

Dan Allen преди 2 години
родител
ревизия
b5bd52cb14
променени са 3 файла, в които са добавени 33 реда и са изтрити 46 реда
  1. 0 5
      .github/actions/dispatch.sh
  2. 0 41
      .github/workflows/antora-generate.yml
  3. 33 0
      .github/workflows/deploy-docs.yml

+ 0 - 5
.github/actions/dispatch.sh

@@ -1,5 +0,0 @@
-REPOSITORY_REF="$1"
-TOKEN="$2"
-
-curl -H "Accept: application/vnd.github.everest-preview+json" -H "Authorization: token ${TOKEN}" --request POST  --data '{"event_type": "request-build-reference"}' https://api.github.com/repos/${REPOSITORY_REF}/dispatches
-echo "Requested Build for $REPOSITORY_REF"

+ 0 - 41
.github/workflows/antora-generate.yml

@@ -1,41 +0,0 @@
-name: Generate Antora Files and Request Build
-
-on:
-  workflow_dispatch:
-  push:
-    branches-ignore:
-      - 'gh-pages'
-    tags: '**'
-
-env:
-  GH_ACTIONS_REPO_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
-
-permissions:
-  contents: read
-
-jobs:
-  build:
-    runs-on: ubuntu-latest
-    if: ${{ github.repository == 'spring-projects/spring-security' }}
-    steps:
-      - name: Checkout Source
-        uses: actions/checkout@v2
-      - name: Set up gradle
-        uses: spring-io/spring-gradle-build-action@v1
-        with:
-          java-version: '11'
-          distribution: 'adopt'
-      - name: Generate antora.yml
-        run: ./gradlew :spring-security-docs:generateAntora
-      - name: Extract Branch Name
-        id: extract_branch_name
-        run: echo "##[set-output name=generated_branch_name;]$(echo ${GITHUB_REPOSITORY}/${GITHUB_REF##*/})"
-      - name: Push generated antora files to the spring-generated-docs
-        uses: JamesIves/github-pages-deploy-action@4.1.4
-        with:
-          branch:  ${{ steps.extract_branch_name.outputs.generated_branch_name }} # The branch the action should deploy to.
-          folder: "docs/build/generateAntora" # The folder the action should deploy.
-          repository-name: "spring-io/spring-generated-docs"
-          token: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
-      - name: Dispatch Build Request
-        run: ${GITHUB_WORKSPACE}/.github/actions/dispatch.sh 'spring-projects/spring-security' "$GH_ACTIONS_REPO_TOKEN"

+ 33 - 0
.github/workflows/deploy-docs.yml

@@ -0,0 +1,33 @@
+name: Deploy Docs
+on:
+  push:
+    branches-ignore: [ gh-pages ]
+    tags: '**'
+  repository_dispatch:
+    types: request-build-reference # legacy
+  schedule:
+  - cron: '0 10 * * *' # Once per day at 10am UTC
+  workflow_dispatch:
+permissions: read-all
+jobs:
+  build:
+    runs-on: ubuntu-latest
+    if: github.repository_owner == 'spring-projects'
+    env:
+      DOCS_BUILD_BRANCH: docs-build
+    steps:
+    - name: Checkout
+      uses: actions/checkout@v3
+      with:
+        ref: $DOCS_BUILD_BRANCH
+        fetch-depth: 1
+    - name: Dispatch (partial build)
+      if: github.ref_type == 'branch'
+      env:
+        GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
+      run: gh workflow run deploy-docs.yml -r $DOCS_BUILD_BRANCH -f build-refname=${{ github.ref_name }}
+    - name: Dispatch (full build)
+      if: github.ref_type == 'tag'
+      env:
+        GH_TOKEN: ${{ secrets.GH_ACTIONS_REPO_TOKEN }}
+      run: gh workflow run deploy-docs.yml -r $DOCS_BUILD_BRANCH