Skip to content

Commit

Permalink
Stop publishing all docs when version is snapshot
Browse files Browse the repository at this point in the history
- Add mode to force publish all docs via `workflow_dispatcher`
  • Loading branch information
JavierSegoviaCordoba committed Dec 31, 2021
1 parent 0869726 commit b387c31
Show file tree
Hide file tree
Showing 2 changed files with 47 additions and 8 deletions.
47 changes: 41 additions & 6 deletions .github/workflows/build-kotlin.yaml
Expand Up @@ -103,11 +103,16 @@ on:
default: ''
required: false
type: string
publish-docs:
description: 'Publish docs to GitHub pages'
deploy-docs:
description: 'Deploy docs to GitHub pages'
default: true
required: false
type: boolean
publish-all-docs:
description: 'Publish all docs to GitHub pages'
default: false
required: false
type: string
secrets:
OSS_USER:
required: false
Expand Down Expand Up @@ -449,13 +454,17 @@ jobs:
-Psemver.stage=snapshot
-PcodeAnalysis.sonar.login=${{ secrets.SONAR_TOKEN }}
- name: Set version to an environment variable
run: echo "lib_version=$(head -n 1 build/semver/version.txt)" >> $GITHUB_ENV

- name: Deploy reports to GitHub Pages
uses: JamesIves/github-pages-deploy-action@4.1.8
with:
branch: 'gh-pages'
folder: 'build/reports-generated/'
clean: true
single-commit: true
single-commit: false
commit-message: 'Deploy ${{ env.lib_version }} reports'
target-folder: 'reports-generated/'
clean-exclude: |
!reports-generated/**
Expand Down Expand Up @@ -506,7 +515,7 @@ jobs:
-Psemver.stage=snapshot
deploy-docs:
if: ((inputs.allow-github-actor-bots == true) || (!contains(github.actor, '[bot]'))) && ((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && (inputs.publish-docs == true)
if: ((inputs.allow-github-actor-bots == true) || (!contains(github.actor, '[bot]'))) && ((github.event_name == 'push') || (github.event_name == 'workflow_dispatch')) && (inputs.deploy-docs == true)

needs: publish-snapshot

Expand Down Expand Up @@ -548,13 +557,39 @@ jobs:
${{ inputs.gradle-args }}
-Psemver.stage=snapshot
- name: Deploy docs to GitHub Pages
- name: Set version to an environment variable
run: echo "lib_version=$(head -n 1 build/semver/version.txt)" >> $GITHUB_ENV

- name: Deploy all docs to GitHub Pages
if: (inputs.publish-all-docs == true)
uses: JamesIves/github-pages-deploy-action@4.1.8
with:
branch: 'gh-pages'
folder: 'build/docs/_site'
single-commit: true
single-commit: false
commit-message: 'Deploy ${{ env.lib_version }} all docs'
clean: true
clean-exclude: |
api/versions/**
reports-generated/**
- name: Keep only versions directories
if: (inputs.publish-all-docs == false)
run: |
mkdir -p build_temp/docs/_site/api/snapshot/
mv build/docs/_site/api/snapshot/* build_temp/docs/_site/api/snapshot
rm -rf build/docs/
mkdir -p build/docs/_site/api/snapshot/
mv build_temp/docs/_site/api/snapshot/* build/docs/_site/api/snapshot
- name: Deploy API docs and reports to GitHub Pages
if: (inputs.publish-all-docs == false)
uses: JamesIves/github-pages-deploy-action@4.1.8
with:
branch: 'gh-pages'
folder: 'build/docs/_site'
single-commit: false
commit-message: 'Deploy ${{ env.lib_version }} API docs and reports'
clean: true
clean-exclude: |
!api/snapshot/**
8 changes: 6 additions & 2 deletions .github/workflows/publish-kotlin.yaml
Expand Up @@ -307,6 +307,9 @@ jobs:
${{ inputs.gradle-args }}
-PcodeAnalysis.sonar.login=${{ secrets.SONAR_TOKEN }}
- name: Set version to an environment variable
run: echo "lib_version=$(head -n 1 build/semver/version.txt)" >> $GITHUB_ENV

- name: Move all tests reports
run: |
mkdir -p build/reports-generated/all-tests
Expand All @@ -317,7 +320,6 @@ jobs:
mkdir -p build/reports-generated/code-analysis
mv build/reports/detekt/detekt.html build/reports-generated/code-analysis/index.html
- name: Move code coverage reports
if: (inputs.code-coverage-report == true)
run: |
Expand All @@ -336,7 +338,8 @@ jobs:
branch: 'gh-pages'
folder: 'build/reports-generated/'
clean: true
single-commit: true
single-commit: false
commit-message: 'Deploy ${{ env.lib_version }} reports'
target-folder: 'reports-generated/'
clean-exclude: |
!reports-generated/**
Expand Down Expand Up @@ -383,6 +386,7 @@ jobs:
single-commit: true
clean: true
clean-exclude: |
api/snapshot/**
api/versions/**
reports-generated/**
Expand Down

0 comments on commit b387c31

Please sign in to comment.