diff --git a/.github/workflows/docs-preview.yml b/.github/workflows/docs-preview.yml index 886e5d488..e46968a1f 100644 --- a/.github/workflows/docs-preview.yml +++ b/.github/workflows/docs-preview.yml @@ -1,27 +1,49 @@ name: Docs Preview on: pull_request: workflow_dispatch: jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - - - name: Build docs - uses: Amadevus/pwsh-script@v2.0.1 - id: docs with: - script: .\ci_oneclick-rebuild-docs.ps1 - - - run: echo '${{ steps.docs.outputs.result }}' + repository: Aiko-IT-Systems/DisCatSharp.Docs.Preview + path: DisCatSharp.Docs.Preview + token: ${{ secrets.DOCS_TOKEN }} + + - name: Build Docs + working-directory: ./DisCatSharp + shell: pwsh + run: | + ./rebuild-docs.ps1 -DocsPath "./DisCatSharp.Docs" -Output ".." -PackageName "dcs-docs-preview" - name: Archive Docs uses: actions/upload-artifact@v2 with: name: preview-docs path: dcs-docs-preview.tar.xz + + - name: Purge old docs + working-directory: ./DisCatSharp.Docs.Preview + run: | + shopt -s extglob + rm -rf !(.git|.gitignore) + + - name: Extract new docs + run: | + tar -xf dcs-docs-preview.tar.xz -C ./DisCatSharp.Docs.Preview + + - name: Commit and push changes + uses: EndBug/add-and-commit@master + with: + cwd: ./DisCatSharp.Docs.Preview + default_author: github_actions + author_name: DisCatSharp + author_email: discatsharp@aitsys.dev + message: 'Preview docs (${{ github.sha }})' + pull: 'NO-PULL'