Skip to content

Commit

Permalink
Added specific manually triggered workflow for documentation and remo…
Browse files Browse the repository at this point in the history
…ved documentation from build.yaml and pullrequest.yaml (#201)
  • Loading branch information
masesdevelopers authored Jan 22, 2024
1 parent 734a2b1 commit 8f7b03c
Show file tree
Hide file tree
Showing 3 changed files with 69 additions and 49 deletions.
42 changes: 4 additions & 38 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -60,47 +60,13 @@ jobs:
fetch-depth: '1'
submodules: 'true'

- name: Precompile tests
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" test\KEFCore.Test.sln

- name: Recompile to create nuget packages
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" src\net\KEFCore.sln

- uses: actions/upload-artifact@v4
with:
name: KEFCore
path: .\bin\*nupkg

- name: Clear documentation folder
run: Remove-Item .\docs\* -Recurse -Force -Exclude _config.yml,CNAME

- run: dotnet tool update -g docfx

- name: Build documentation
run: |
cd src\documentation
docfx
- name: Extract commit SHA
run: |
echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
shell: bash

- name: Request a PR to commit changes
if: ${{ github.repository_owner == 'masesgroup'}} #do not push any changes outside main repo
uses: peter-evans/create-pull-request@v5
with:
branch-suffix: short-commit-hash
add-paths: docs/*.*
commit-message: Update documentation after commit ${{ env.GITHUB_COMMIT_MESSAGE }}
title: Changes by GitHub action
body: Automated changes by GitHub action
reviewers: masesdevelopers
assignees: masesdevelopers
labels: documentation, enhancement

# - name: Commit changes
# if: ${{ github.repository_owner == 'masesgroup'}} #do not push any changes outside main repo
# uses: EndBug/add-and-commit@v9
# with:
# author_name: github-actions
# author_email: 41898282+github-actions[bot]@users.noreply.github.com
# add: '.\docs\*.*'
# message: Update documentation after commit ${{ env.GITHUB_COMMIT_MESSAGE }}
path: .\bin\*nupkg
61 changes: 61 additions & 0 deletions .github/workflows/documentation.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
# This is a basic workflow to help you get started with Actions

name: CI_DOCUMENTATION

# Controls when the action will run. Triggers the workflow on push
# events but only for the master branch
on:
workflow_dispatch:
inputs:
GeneratePR:
description: 'Generate the PR at the end'
required: true
default: false
type: boolean

# This workflow contains one job called "build_documentation"
jobs:
build_documentation:
# The type of runner that the job will run on
runs-on: windows-2022

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Runs a set of commands using the runners shell
# Support longpaths
- name: Support long paths
run: git config --system core.longpaths true

# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v4
with:
fetch-depth: '1'
submodules: 'true'

- name: Clear documentation folder
run: Remove-Item .\docs\* -Recurse -Force -Exclude _config.yml,CNAME

- run: dotnet tool update -g docfx

- name: Build documentation
run: |
cd src\documentation
docfx
- name: Extract commit SHA
run: |
echo "GITHUB_COMMIT_MESSAGE=$(echo $GITHUB_SHA | cut -c 1-7)" >> $GITHUB_ENV
shell: bash

- name: Request a PR to commit changes
if: ${{ github.repository_owner == 'masesgroup' && inputs.GeneratePR == true }} #do not push any changes outside main repo or GeneratePR is false
uses: peter-evans/create-pull-request@v5
with:
branch-suffix: short-commit-hash
add-paths: docs/*.*
commit-message: Update documentation after commit ${{ env.GITHUB_COMMIT_MESSAGE }}
title: Changes by GitHub action
body: Automated changes by GitHub action
reviewers: masesdevelopers
assignees: masesdevelopers
labels: documentation, enhancement
15 changes: 4 additions & 11 deletions .github/workflows/pullrequest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -57,15 +57,8 @@ jobs:
fetch-depth: '1'
submodules: 'true'

- name: Compile
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" src\net\KEFCore.sln
- name: Precompile tests
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" test\KEFCore.Test.sln

- name: Clear documentation folder
run: Remove-Item .\docs\* -Recurse -Force -Exclude _config.yml,CNAME

- run: dotnet tool update -g docfx

- name: Build documentation
run: |
cd src\documentation
docfx
- name: Compile code
run: dotnet build --no-incremental --configuration Release /p:Platform="Any CPU" src\net\KEFCore.sln

0 comments on commit 8f7b03c

Please sign in to comment.