From ffef6e63b4de4d6ad2239843d50ad9d25ec9ef4f Mon Sep 17 00:00:00 2001 From: Rebecca Stevens Date: Sun, 19 Feb 2023 22:19:59 +1300 Subject: [PATCH] docs: push docs coverage changes after updating the docs --- .github/actions/prepare/action.yml | 1 + .github/actions/prepare/git-config.yml | 10 ++++++++++ .github/workflows/release-docs.yml | 20 ++++++++++++++++++++ .github/workflows/release.yml | 2 -- 4 files changed, 31 insertions(+), 2 deletions(-) create mode 100644 .github/actions/prepare/git-config.yml diff --git a/.github/actions/prepare/action.yml b/.github/actions/prepare/action.yml index 3f340815..c04844e1 100644 --- a/.github/actions/prepare/action.yml +++ b/.github/actions/prepare/action.yml @@ -17,3 +17,4 @@ runs: cache: "pnpm" - run: pnpm install --frozen-lockfile shell: bash + - uses: ./.github/actions/git-config diff --git a/.github/actions/prepare/git-config.yml b/.github/actions/prepare/git-config.yml new file mode 100644 index 00000000..ee16edc2 --- /dev/null +++ b/.github/actions/prepare/git-config.yml @@ -0,0 +1,10 @@ +name: Prepare +description: Configrue the git user + +runs: + using: "composite" + steps: + - name: Configure Git + run: | + git config --global user.email "${GITHUB_ACTOR}@users.noreply.github.com" + git config --global user.name ${GITHUB_ACTOR} diff --git a/.github/workflows/release-docs.yml b/.github/workflows/release-docs.yml index 054d5fe1..69bddcaa 100644 --- a/.github/workflows/release-docs.yml +++ b/.github/workflows/release-docs.yml @@ -49,6 +49,8 @@ jobs: - name: Checkout src uses: actions/checkout@v3 + - uses: ./.github/actions/git-config + - run: mkdir -p ./gh-pages - name: Download the existing documents artifact uses: actions/download-artifact@v3 @@ -75,3 +77,21 @@ jobs: - name: Deploy to GitHub Pages id: deployment uses: actions/deploy-pages@v1 + + - name: Update Coverage Badge + env: + PACKAGE_VERSION: > + $(cat package.json \ + | grep version \ + | head -1 \ + | awk -F: '{ print $2 }' \ + | sed 's/[",]//g') + run: cp ./gh-pages/v$PACKAGE_VERSION/coverage.svg ./docs/coverage.svg + + - run: COVERAGE_CHANGED=$(git status --porcelain -u | grep -c docs/coverage.svg) + - if: $COVERAGE_CHANGED != "0" + run: > + git add docs/coverage.svg + git diff --name-only --cached --diff-filter=AM + git commit -m "docs: updated documentation coverage" + git push diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 5ff2821d..b939308b 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -17,8 +17,6 @@ jobs: fetch-depth: 0 - uses: ./.github/actions/prepare - run: pnpm build - - run: git config user.name "${GITHUB_ACTOR}" - - run: git config user.email "${GITHUB_ACTOR}@users.noreply.github.com" - env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN