Skip to content

fix: call publish workflow from update cli #168

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Aug 3, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# This gets called from the update-cli workflow
workflow_call:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
Expand Down
38 changes: 9 additions & 29 deletions .github/workflows/update-cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,16 +9,11 @@ permissions:
contents: write

jobs:
build:
update-cli:
runs-on: ubuntu-latest
steps:
- name: Check out source
uses: actions/checkout@v3
- name: Check out documentation branch
uses: actions/checkout@v3
with:
ref: 'dist'
path: 'public'
- name: Use Node.js
uses: actions/setup-node@v3
with:
Expand All @@ -44,26 +39,11 @@ jobs:
git config user.name 'npm CLI robot'
git config user.email '[email protected]'
git commit -m 'CLI documentation update from CI'
- name: Build documentation
run: npm run build
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Push source changes
if: steps.status.outputs.has_changes == '1'
run: git push origin main
- name: Check for changes to docs
id: docs-status
working-directory: public
run: |
if [ -n "$(git status --porcelain)" ]; then
echo "::set-output name=has_changes::1"
fi
- name: Publish documentation
if: steps.docs-status.outputs.has_changes == '1'
working-directory: public
run: |
git add --verbose .
git config user.name 'npm CLI robot'
git config user.email '[email protected]'
git commit -m 'CLI documentation update from CI'
git push origin dist
git push origin main

deploy:
runs-on: ubuntu-latest
needs: update-cli
steps:
- name: Call publish workflow
uses: ./.github/workflows/publish.yml