Update CLI #1423
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
# This file is automatically added by @npmcli/template-oss. Do not edit. | |
name: Update CLI | |
on: | |
workflow_dispatch: | |
schedule: | |
- cron: "14 2 * * *" | |
jobs: | |
update-cli: | |
outputs: | |
has_changes: ${{ steps.status.outputs.has_changes }} | |
name: Update CLI | |
if: github.repository_owner == 'npm' | |
runs-on: ubuntu-latest | |
defaults: | |
run: | |
shell: bash | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Git User | |
run: | | |
git config --global user.email "[email protected]" | |
git config --global user.name "npm CLI robot" | |
- name: Setup Node | |
uses: actions/setup-node@v4 | |
id: node | |
with: | |
node-version: 22.x | |
check-latest: contains('22.x', '.x') | |
cache: npm | |
- name: Install Latest npm | |
uses: ./.github/actions/install-latest-npm | |
with: | |
node: ${{ steps.node.outputs.node-version }} | |
- name: Install Dependencies | |
run: npm i --no-audit --no-fund | |
- name: Build documentation | |
run: npm run build -w cli | |
env: | |
# token is used to get files from `npm/cli` that | |
# are not present in the published tarball | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: Check for changes | |
id: status | |
run: | | |
if [ -n "$(git status --porcelain)" ]; then | |
echo "::set-output name=has_changes::1" | |
fi | |
- name: Check in source updates | |
if: steps.status.outputs.has_changes == '1' | |
run: | | |
git add --verbose . | |
git commit -m 'CLI documentation update from CI' | |
git push origin main | |
publish: | |
needs: update-cli | |
if: needs.update-cli.outputs.has_changes == '1' | |
uses: ./.github/workflows/publish.yml |