Merge pull request #1525 from bUnit-dev/docs/input-files #103
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: "docs-deploy" | |
concurrency: "docs-deploy" | |
on: | |
push: | |
branches: | |
- stable | |
paths: | |
- 'docs/**' | |
workflow_run: | |
branches: [ main ] | |
workflows: [ 'release' ] | |
types: [ completed ] | |
workflow_dispatch: | |
env: | |
VSTEST_CONNECTION_TIMEOUT: 180 | |
DOTNET_SKIP_FIRST_TIME_EXPERIENCE: 1 | |
DOTNET_NOLOGO: true | |
DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION: 1 | |
TERM: xterm | |
jobs: | |
deploy: | |
name: 📃 Deploy new version bunit.dev | |
if: github.ref == 'refs/heads/stable' || ${{ github.event.workflow_run.conclusion == 'success' }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: 🛒 Checkout repository | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
token: ${{ secrets.BUNIT_BOT_TOKEN }} | |
- name: ⚙️ Import GPG key | |
id: import_gpg | |
uses: crazy-max/ghaction-import-gpg@v6 | |
with: | |
gpg_private_key: ${{ secrets.BUNIT_BOT_GPG_PRIVATE_KEY }} | |
passphrase: ${{ secrets.BUNIT_BOT_GPG_KEY_PASSPHRASE }} | |
- name: ⚙️ Setup CI GIT | |
run: | | |
git config user.name "${{ steps.import_gpg.outputs.name }}" | |
git config user.email ${{ steps.import_gpg.outputs.email }} | |
git config --global user.signingkey ${{ steps.import_gpg.outputs.keyid }} | |
git config --global commit.gpgsign true | |
- name: ⚙️ Setup GIT versioning | |
uses: dotnet/[email protected] | |
with: | |
setAllVars: true | |
- name: 🛠️ Get Changelog Entry | |
id: changelog_reader | |
uses: mindsers/changelog-reader-action@v2 | |
with: | |
path: ./CHANGELOG.md | |
- name: 🛠️ Update tokens in project files | |
uses: cschleiden/replace-tokens@v1 | |
with: | |
files: '["docs/site/*.md", "docs/**/*.md", "docs/**/*.tmpl.partial", "*.csproj", "**/*.csproj", "src/Directory.Build.props"]' | |
env: | |
RELEASE_VERSION: ${{ steps.changelog_reader.outputs.version }} | |
RELEASE_NOTES: ${{ steps.changelog_reader.outputs.changes }} | |
- name: ⚙️ Setup dotnet versions | |
uses: actions/setup-dotnet@v4 | |
with: | |
dotnet-version: | | |
3.1.x | |
5.0.x | |
6.0.x | |
7.0.x | |
8.0.x | |
9.0.x | |
- name: 🎨 Setup color | |
run: | | |
echo "DOTNET_SYSTEM_CONSOLE_ALLOW_ANSI_COLOR_REDIRECTION=1" >> $GITHUB_ENV | |
echo "TERM=xterm" >> $GITHUB_ENV | |
- name: 🛠️ Building bUnit | |
run: dotnet build /p:PublicRelease=true -c release | |
- name: 🛠️ Verify docs samples | |
run: dotnet test docs/samples/samples.sln | |
- name: 📄 Building docs | |
working-directory: ./docs/site | |
run: | | |
dotnet tool install --global docfx --version 2.74.1 | |
docfx metadata --logLevel error | |
docfx build | |
- name: 🛠️ Deploy to GitHub Pages | |
if: success() | |
uses: crazy-max/ghaction-github-pages@v4 | |
with: | |
build_dir: docs/site/_site | |
fqdn: bunit.dev | |
repo: bUnit-dev/bUnit-dev.github.io | |
target_branch: main | |
keep_history: false | |
jekyll: false | |
committer: "bUnit bot <[email protected]>" | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
GH_PAT: ${{ secrets.BUNIT_BOT_TOKEN }} | |
- name: ⏩ Merge stable with main, push origin | |
id: mergeMainline | |
continue-on-error: true | |
run: | | |
git checkout main | |
git merge -S stable | |
git push origin main | |
- name: ⏭ Create pull request from stable to main when direct merge fails | |
if: steps.mergeMainline.outcome == 'failure' | |
uses: thomaseizinger/[email protected] | |
env: | |
GITHUB_TOKEN: ${{ secrets.BUNIT_BOT_TOKEN }} | |
with: | |
head: stable | |
base: main | |
title: Update main with documentation in stable | |
reviewers: ${{ github.actor }} # By default, we request a review from the person who triggered the workflow. | |
body: | | |
Hi @${{ github.actor }} | |
This PR was created because the [docs-deploy](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }}) failed to automatically merge stable into main. |