Update module github.com/spf13/cobra to v1.8.0 - autoclosed #30
Workflow file for this run
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: Book preview | |
on: | |
pull_request: | |
jobs: | |
build: | |
name: Build book | |
runs-on: ubuntu-20.04 | |
outputs: | |
branch: ${{ steps.extract_branch.outputs.branch }} | |
steps: | |
- name: Extract branch name | |
shell: bash | |
run: echo "::set-output name=branch::$(REF=${GITHUB_HEAD_REF:-$GITHUB_REF} && echo ${REF#refs/heads/} | sed 's/\//-/g')" | |
id: extract_branch | |
- uses: actions/checkout@v3 | |
- run: make book | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: preview | |
path: docs/book | |
retention-days: 1 | |
publish: | |
name: Publish book on GitHub Pages | |
runs-on: ubuntu-20.04 | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
ref: gh-pages | |
- run: rm -rf _preview/${{ needs.build.outputs.branch }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: preview | |
path: _preview/${{ needs.build.outputs.branch }} | |
- run: git add . | |
- name: Check diff | |
run: | | |
diffs=$(git status -s) | |
if [ "$diffs" = "" ]; then | |
echo "NO_DIFF=1" >> $GITHUB_ENV | |
else | |
printf "%s\n" "$diffs" | |
fi | |
- name: Commit changes | |
if: env.NO_DIFF != '1' | |
run: | | |
git config --global user.name 'github-actions[bot]' | |
git config --global user.email '41898282+github-actions[bot]@users.noreply.github.com' | |
git commit -m 'update' | |
- name: Push to gh-pages | |
if: env.NO_DIFF != '1' | |
run: git push origin gh-pages | |
- name: Write comment | |
if: github.event_name == 'pull_request' && github.event.action == 'opened' | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: | | |
gh pr comment ${{ github.event.pull_request.number }} --body "Preview: https://kmdk.uk/goct/_preview/${{ needs.build.outputs.branch }}" |