diff --git a/.github/actions/build_documentation/action.yml b/.github/actions/build_documentation/action.yml new file mode 100644 index 0000000000..17ea642294 --- /dev/null +++ b/.github/actions/build_documentation/action.yml @@ -0,0 +1,18 @@ +name: 'Build Documentation' +description: 'Build documentation files' +runs: + using: 'composite' + steps: + - name: Install Hugo + shell: bash + run: | + mkdir hugo + curl -L https://github.com/gohugoio/hugo/releases/download/v0.150.0/hugo_0.150.0_linux-amd64.tar.gz | tar -xzf - -C hugo + echo "$(pwd)/hugo" >> $GITHUB_PATH + + - name: Install Node and dependencies + uses: mongodb-labs/drivers-github-tools/node/setup@v2 + + - name: Build Docs + run: npm run build:docs -- --yes + shell: bash diff --git a/.github/workflows/build_and_commit_docs.yml b/.github/workflows/build_and_commit_docs.yml index e4db200abb..46317f7db7 100644 --- a/.github/workflows/build_and_commit_docs.yml +++ b/.github/workflows/build_and_commit_docs.yml @@ -5,24 +5,27 @@ on: name: Build and commit documentation +permissions: + contents: write + pull-requests: write + jobs: build-docs: # prevent subsequent commits from triggering the job multiple times concurrency: group: ci-${{ github.ref }} cancel-in-progress: true - name: "Build documentation." - uses: ./.github/workflows/build.yml - commit-docs: - needs: [build-docs] - permissions: - contents: write - pull-requests: write - runs-on: ubuntu-latest + runs-on: 'ubuntu-latest' + steps: - - name: Open Pull Request - uses: peter-evans/create-pull-request@v6 - with: - title: 'docs: generate docs from latest main [skip-ci]' - delete-branch: true \ No newline at end of file + - uses: actions/checkout@v5 + + - name: "Build documentation" + uses: ./.github/actions/build_documentation + + - name: Open Pull Request + uses: peter-evans/create-pull-request@v6 + with: + title: 'docs: generate docs from latest main [skip-ci]' + delete-branch: true diff --git a/.github/workflows/build_docs.yml b/.github/workflows/build_docs.yml index bd1804b9c2..dd7b265c93 100644 --- a/.github/workflows/build_docs.yml +++ b/.github/workflows/build_docs.yml @@ -15,16 +15,4 @@ jobs: steps: - uses: actions/checkout@v5 - - - name: Install Hugo - run: | - mkdir hugo - curl -L https://github.com/gohugoio/hugo/releases/download/v0.150.0/hugo_0.150.0_linux-amd64.tar.gz | tar -xzf - -C hugo - echo "$(pwd)/hugo" >> $GITHUB_PATH - - - name: Install Node and dependencies - uses: mongodb-labs/drivers-github-tools/node/setup@v2 - - - name: Build Docs - run: npm run build:docs -- --yes - + - uses: ./.github/actions/build_documentation