-
Notifications
You must be signed in to change notification settings - Fork 3.2k
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: add github action for release #4659
Merged
fritzy
merged 6 commits into
latest
from
release/this-is-named-release-so-actions-will-run
Apr 13, 2022
Merged
Changes from all commits
Commits
Show all changes
6 commits
Select commit
Hold shift + click to select a range
3902286
fix: skip update notifier file if not requested
lukekarrys 296bd04
chore: refactor smoke-tests
lukekarrys dd7c7de
chore: add test-all to makefile
lukekarrys 1bd8b36
chore: make git dirty check more strict
lukekarrys a5c4e77
chore: do less smoke testing on every commit
lukekarrys 6a1d4ce
chore: add release github action
lukekarrys File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,7 +10,6 @@ | |
"overrides": [{ | ||
"files": [ | ||
"scripts/**", | ||
"smoke-tests/**", | ||
"bin/**", | ||
"test/**" | ||
], | ||
|
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 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,118 @@ | ||
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 * * *" | ||
|
||
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 | ||
- name: Use Node.js 16.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
cache: npm | ||
- run: node bin/npm-cli.js run resetdeps | ||
- 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: | ||
node-version: | ||
- 12.13.0 | ||
- 12.x | ||
- 14.15.0 | ||
- 14.x | ||
- 16.0.0 | ||
- 16.x | ||
platform: | ||
- os: ubuntu-latest | ||
shell: bash | ||
- os: macos-latest | ||
shell: bash | ||
# XXX: this should be possible in windows also | ||
# but resetdeps cant be a bash script | ||
runs-on: ${{ matrix.platform.os }} | ||
defaults: | ||
run: | ||
shell: ${{ matrix.platform.shell }} | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Setup git user | ||
run: | | ||
git config --global user.email "ops+npm-cli@npmjs.com" | ||
git config --global user.name "npm cli ops bot" | ||
- name: Use Node.js 16.x | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: 16.x | ||
cache: npm | ||
- name: Pack | ||
run: | | ||
NPM_VERSION="$(node bin/npm-cli.js --version)-$GITHUB_SHA.0" | ||
node bin/npm-cli.js version $NPM_VERSION --ignore-scripts | ||
node bin/npm-cli.js run resetdeps | ||
git clean -fd | ||
node bin/npm-cli.js ls --production >/dev/null | ||
node bin/npm-cli.js prune --production --no-save --no-audit --no-fund | ||
node scripts/git-dirty.js | ||
node bin/npm-cli.js pack --pack-destination=$RUNNER_TEMP | ||
node bin/npm-cli.js install -g $RUNNER_TEMP/npm-$NPM_VERSION.tgz | ||
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: | ||
node-version: | ||
- 12.13.0 | ||
- 12.x | ||
- 14.15.0 | ||
- 14.x | ||
- 16.0.0 | ||
- 16.x | ||
platform: | ||
- os: ubuntu-latest | ||
shell: bash | ||
- os: macos-latest | ||
shell: bash | ||
- os: windows-latest | ||
shell: cmd | ||
runs-on: ${{ matrix.platform.os }} | ||
defaults: | ||
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 |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -78,17 +78,14 @@ docs/content/commands/npm-%.md: docs/bin/config-doc-command.js lib/commands/%.js | |
|
||
freshdocs: | ||
touch lib/utils/config/definitions.js | ||
touch "docs/bin/*.js" | ||
touch docs/bin/*.js | ||
make docs | ||
|
||
test: deps | ||
node bin/npm-cli.js test | ||
|
||
smoke-tests: deps | ||
node bin/npm-cli.js run smoke-tests | ||
test-all: deps | ||
node bin/npm-cli.js run test-all | ||
|
||
ls-ok: | ||
node . ls --production >/dev/null | ||
node bin/npm-cli.js ls --production >/dev/null | ||
|
||
gitclean: | ||
git clean -fd | ||
|
@@ -100,16 +97,15 @@ link: uninstall | |
node bin/npm-cli.js link -f --ignore-scripts | ||
|
||
prune: deps | ||
node bin/npm-cli.js prune --production --no-save --no-audit | ||
@[[ "$(shell git status -s)" != "" ]] && echo "ERR: found unpruned files" && exit 1 || echo "git status is clean" | ||
node bin/npm-cli.js prune --production --no-save --no-audit --no-fund | ||
node scripts/git-dirty.js | ||
|
||
publish: gitclean ls-ok link test smoke-tests docs prune | ||
@git push origin :v$(shell node bin/npm-cli.js --no-timing -v) 2>&1 || true | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Our release process always includes us creating the tag before running this step, so this was unnecessary. It wasn't erroring but would show the message that the tag already existed. |
||
publish: gitclean ls-ok link test-all docs prune | ||
git push origin $(BRANCH) &&\ | ||
git push origin --tags &&\ | ||
node bin/npm-cli.js publish --tag=$(PUBLISHTAG) | ||
|
||
release: gitclean ls-ok docs prune | ||
@bash scripts/release.sh | ||
|
||
.PHONY: all latest install dev link docs clean uninstall test man docsclean release ls-ok deps prune freshdocs | ||
.PHONY: all latest install dev link docs clean uninstall test-all man docsclean release ls-ok deps prune freshdocs |
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 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 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
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This is almost ready to run in Windows, but needs resetdeps and the
rm -rf
to be cross platform. I'm saving that for a future PR.