Skip to content
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

chore: use release please #5446

Merged
merged 1 commit into from Aug 31, 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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/ci-docs.yml
Expand Up @@ -81,7 +81,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w docs
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmaccess.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmaccess
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmdiff.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmdiff
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmexec.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmexec
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmfund.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmfund
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmhook.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmhook
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmorg.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmorg
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmpack.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmpack
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmpublish.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmpublish
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmsearch.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmsearch
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmteam.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmteam
2 changes: 1 addition & 1 deletion .github/workflows/ci-libnpmversion.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w libnpmversion
2 changes: 1 addition & 1 deletion .github/workflows/ci-npmcli-arborist.yml
Expand Up @@ -86,7 +86,7 @@ jobs:
if: ${{ !startsWith(matrix.node-version, '10.') }}
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: add tap problem matcher
run: echo "::add-matcher::.github/matchers/tap.json"
- run: npm i --ignore-scripts --no-audit --no-fund
- run: npm test --ignore-scripts -w @npmcli/arborist
78 changes: 61 additions & 17 deletions .github/workflows/release-please.yml
Expand Up @@ -16,22 +16,40 @@ jobs:
release-please:
runs-on: ubuntu-latest
outputs:
prs: ${{ steps.release.outputs.prs }}
pr: ${{ steps.release.outputs.pr }}
release: ${{ steps.release.outputs.release }}
steps:
- uses: google-github-actions/release-please-action@v3
id: release
- uses: actions/checkout@v3
- name: Setup git user
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- uses: actions/setup-node@v3
with:
command: manifest
node-version: 16.x
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: Release Please
id: release
run: npx --offline template-oss-release-please
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

update-prs:
post-pr:
needs: release-please
if: needs.release-please.outputs.prs
if: needs.release-please.outputs.pr
runs-on: ubuntu-latest
strategy:
matrix:
pr: ${{ fromJSON(needs.release-please.outputs.prs) }}
outputs:
ref: ${{ steps.ref.outputs.branch }}
steps:
- name: Output ref
id: ref
run: echo "::set-output name=branch::${{ fromJSON(needs.release-please.outputs.pr).headBranchName }}"
- uses: actions/checkout@v3
with:
ref: ${{ steps.ref.outputs.branch }}
- name: Setup git user
run: |
git config --global user.email "npm-cli+bot@github.com"
Expand All @@ -42,15 +60,41 @@ jobs:
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- name: Update PR ${{ matrix.pr.number }} dependencies and commit
- run: npm i --ignore-scripts --no-audit --no-fund
- name: Post pull request actions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
gh pr checkout ${{ matrix.pr.number }}
npm run resetdeps
title="${{ matrix.pr.title }}"
# get the dependency spec from the pr title
# get everything after ': release ' + replace space with @
dep_spec=$(echo "${title##*: release }" | tr ' ' @)
git commit -am "deps: $dep_spec"
npm run rp-pull-request --ignore-scripts --if-present -ws -iwr
git commit -am "chore: post pull request" || true
git push

release-test:
needs: post-pr
if: needs.post-pr.outputs.ref
uses: ./.github/workflows/release.yml
with:
ref: ${{ needs.post-pr.outputs.ref }}

post-release:
needs: release-please
if: needs.release-please.outputs.release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Setup git user
run: |
git config --global user.email "npm-cli+bot@github.com"
git config --global user.name "npm CLI robot"
- uses: actions/setup-node@v3
with:
node-version: 16.x
- name: Update npm to latest
run: npm i --prefer-online --no-fund --no-audit -g npm@latest
- run: npm -v
- run: npm i --ignore-scripts --no-audit --no-fund
- name: Post release actions
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
npm run rp-release --ignore-scripts --if-present -ws -iwr
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Future idea is that this hook could run .github/workflows/create-cli-deps-pr.yml and trigger a docs site deploy. But there is enough churn here that I'm leaving this for a future effort.

55 changes: 24 additions & 31 deletions .github/workflows/release.yml
@@ -1,22 +1,19 @@
name: Release - cli

on:
workflow_dispatch:
pull_request:
schedule:
# 08:00am UTC everyday: https://crontab.guru/#0_8_*_*_*
# https://dateful.com/convert/utc?t=8am
- cron: "0 8 * * *"
workflow_call:
inputs:
ref:
required: true
type: string

jobs:
lint-all:
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.head_ref, 'release/')
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Use Node.js 16.x
uses: actions/setup-node@v3
with:
Expand All @@ -26,10 +23,6 @@ jobs:
- run: node bin/npm-cli.js run lint-all --ignore-scripts

smoke-publish:
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.head_ref, 'release/')
strategy:
fail-fast: false
matrix:
Expand All @@ -53,6 +46,8 @@ jobs:
shell: ${{ matrix.platform.shell }}
steps:
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Setup git user
run: |
git config --global user.email "ops+npm-cli@npmjs.com"
Expand All @@ -76,12 +71,8 @@ jobs:
node bin/npm-cli.js install -w smoke-tests --ignore-scripts --no-audit --no-fund
rm -rf {lib,bin,index.js}
SMOKE_PUBLISH_NPM=1 npm test -w smoke-tests --ignore-scripts

test-all:
if: |
github.event_name == 'schedule' ||
github.event_name == 'workflow_dispatch' ||
startsWith(github.head_ref, 'release/')
strategy:
fail-fast: false
matrix:
Expand All @@ -104,15 +95,17 @@ jobs:
run:
shell: ${{ matrix.platform.shell }}
steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: node bin/npm-cli.js run resetdeps
- run: node bin/npm-cli.js link -f --ignore-scripts
- run: node bin/npm-cli.js run test-all --ignore-scripts
- name: git status
if: matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
- uses: actions/checkout@v3
with:
ref: ${{ inputs.ref }}
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
node-version: ${{ matrix.node-version }}
cache: npm
- run: node bin/npm-cli.js run resetdeps
- run: node bin/npm-cli.js link -f --ignore-scripts
- run: node bin/npm-cli.js run test-all --ignore-scripts
- name: git status
if: matrix.platform.os != 'windows-latest'
run: node scripts/git-dirty.js
1 change: 1 addition & 0 deletions .release-please-manifest.json
@@ -1,4 +1,5 @@
{
".": "8.18.0",
"workspaces/arborist": "5.6.0",
"workspaces/libnpmaccess": "6.0.3",
"workspaces/libnpmdiff": "4.0.4",
Expand Down
4 changes: 2 additions & 2 deletions docs/package.json
Expand Up @@ -24,7 +24,7 @@
"@npmcli/eslint-config": "^3.1.0",
"@npmcli/fs": "^2.1.0",
"@npmcli/promise-spawn": "^3.0.0",
"@npmcli/template-oss": "3.7.1",
"@npmcli/template-oss": "3.8.0",
"cmark-gfm": "^0.9.0",
"jsdom": "^18.1.0",
"marked-man": "^0.7.0",
Expand Down Expand Up @@ -60,6 +60,6 @@
"ciVersions": [
"16"
],
"version": "3.7.1"
"version": "3.8.0"
}
}