fix: call publish workflow from update cli (#168)
Luke Karrys committed
Aug 3, 2022 at 10:39 UTC
d5872c395bda823d3d60f059fc8cf0e7d6d96d7c
2 files changed
+12
-29
.github/workflows/publish.yml
+3
@@ -9,6 +9,9 @@ on:
9
# Allows you to run this workflow manually from the Actions tab
10
workflow_dispatch:
11
12
+ # This gets called from the update-cli workflow
13
+ workflow_call:
14
+
15
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
16
permissions:
17
contents: read
.github/workflows/update-cli.yml
+9
-29
@@ -9,16 +9,11 @@ permissions:
9
contents: write
10
11
jobs:
12
- build:
12
+ update-cli:
13
runs-on: ubuntu-latest
14
steps:
15
- name: Check out source
16
uses: actions/checkout@v3
17
- - name: Check out documentation branch
18
- uses: actions/checkout@v3
19
- with:
20
- ref: 'dist'
21
- path: 'public'
17
- name: Use Node.js
18
uses: actions/setup-node@v3
19
with:
@@ -44,26 +39,11 @@ jobs:
39
git config user.name 'npm CLI robot'
40
git config user.email 'npm-cli+bot@github.com'
41
git commit -m 'CLI documentation update from CI'
47
- - name: Build documentation
48
- run: npm run build
49
- env:
50
- GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
51
- - name: Push source changes
52
- if: steps.status.outputs.has_changes == '1'
53
- run: git push origin main
54
- - name: Check for changes to docs
55
- id: docs-status
56
- working-directory: public
57
- run: |
58
- if [ -n "$(git status --porcelain)" ]; then
59
- echo "::set-output name=has_changes::1"
60
- fi
61
- - name: Publish documentation
62
- if: steps.docs-status.outputs.has_changes == '1'
63
- working-directory: public
64
- run: |
65
- git add --verbose .
66
- git config user.name 'npm CLI robot'
67
- git config user.email 'npm-cli+bot@github.com'
68
- git commit -m 'CLI documentation update from CI'
69
- git push origin dist
42
+ git push origin main
43
+
44
+ deploy:
45
+ runs-on: ubuntu-latest
46
+ needs: update-cli
47
+ steps:
48
+ - name: Call publish workflow
49
+ uses: ./.github/workflows/publish.yml