diff --git a/.github/workflows/docs-update.yaml b/.github/workflows/docs-update.yaml new file mode 100644 index 000000000..90c59bd53 --- /dev/null +++ b/.github/workflows/docs-update.yaml @@ -0,0 +1,64 @@ +# When we push a new tag to the repository, open a Pull Request to synchronize +# the API reference and other documentation with the "docs" repository. + +name: "Update docs" + +concurrency: + group: "ci-${{ github.ref_name }}" + cancel-in-progress: true + +on: + push: + tags: + - 'v*' + +jobs: + push-api-docs: + runs-on: "ubuntu-latest" + steps: + - name: "Checkout 'fabric' repository" + uses: "actions/checkout@v4" + with: + fetch-depth: 0 + persist-credentials: "false" + + - name: "Checkout 'docs' repository" + uses: "actions/checkout@v4" + with: + repository: "githedgehog/docs" + path: "project_documentation" + persist-credentials: "false" + + - name: "Copy API reference from 'fabric' to 'docs'" + run: | + cp docs/api.md project_documentation/docs/reference/api.md + cp docs/profiles.md project_documentation/docs/reference/profiles.md + cp docs/supported-devices.md project_documentation/docs/install-upgrade/supported-devices.md.gen + + - name: "Generate token for the 'docs' repository" + uses: "actions/create-github-app-token@v2" + id: "app-token" + with: + app-id: "${{ secrets.DOCS_APP_ID }}" + private-key: "${{ secrets.DOCS_PRIVATE_KEY }}" + repositories: | + docs + + - name: "Create Pull Request" + uses: "peter-evans/create-pull-request@v5" + with: + token: "${{ steps.app-token.outputs.token }}" + path: "project_documentation" + commit-message: | + Update docs from ${{ github.repository }}@${{ github.ref_name }}. + + This is an automated commit created by GitHub Actions workflow, + in the "${{ github.repository }}" repository. + signoff: true + title: "Update docs from ${{ github.repository }}@${{ github.ref_name }}" + body: | + This is an automated Pull Request created by GitHub Actions workflow, + in the "${{ github.repository }}" repository. + + It should be merged only after ${{ github.repository }} in the fabricator + repository master branch updated to the ${{ github.ref_name }}.