Skip to content

Commit

Permalink
fix: publish package as latest
Browse files Browse the repository at this point in the history
  • Loading branch information
3846masa committed Jun 27, 2022
1 parent 00edb9c commit 8269bc5
Show file tree
Hide file tree
Showing 5 changed files with 42 additions and 0 deletions.
7 changes: 7 additions & 0 deletions .releaserc.json
Expand Up @@ -23,6 +23,13 @@
{
"assets": ["CHANGELOG.md", "package.json"]
}
],
[
"@semantic-release/exec",
{
"publishCmd": "./scripts/publish.sh",
"verifyConditionsCmd": "./scripts/verify_conditions.sh"
}
]
],
"preset": "angular",
Expand Down
1 change: 1 addition & 0 deletions package.json
Expand Up @@ -49,6 +49,7 @@
"@babel/preset-typescript": "7.17.12",
"@semantic-release/changelog": "6.0.1",
"@semantic-release/commit-analyzer": "9.0.2",
"@semantic-release/exec": "6.0.3",
"@semantic-release/git": "10.0.1",
"@semantic-release/npm": "9.0.1",
"@semantic-release/release-notes-generator": "10.0.3",
Expand Down
12 changes: 12 additions & 0 deletions scripts/publish.sh
@@ -0,0 +1,12 @@
#!/bin/bash
set -eux

## Clear npm_config_* env
unset "${!npm_config_@}"
unset "${!NPM_CONFIG_@}"

PACKAGE_NAME=$(npm -s run env echo '$npm_package_name')
PACKAGE_VERSION=$(npm -s run env echo '$npm_package_version')

## Set latest tag
npm dist-tag add "${PACKAGE_NAME}@${PACKAGE_VERSION}" latest --userconfig /tmp/.npmrc
10 changes: 10 additions & 0 deletions scripts/verify_conditions.sh
@@ -0,0 +1,10 @@
#!/bin/bash
set -eux

## Clear npm_config_* env
unset "${!npm_config_@}"
unset "${!NPM_CONFIG_@}"

## Create npmrc
echo '//registry.npmjs.org/:_authToken=${NPM_TOKEN}' > /tmp/.npmrc
npm whoami --userconfig /tmp/.npmrc 1>&2
12 changes: 12 additions & 0 deletions yarn.lock
Expand Up @@ -1603,6 +1603,18 @@
resolved "https://registry.yarnpkg.com/@semantic-release/error/-/error-3.0.0.tgz#30a3b97bbb5844d695eb22f9d3aa40f6a92770c2"
integrity sha512-5hiM4Un+tpl4cKw3lV4UgzJj+SmfNIDCLLw0TepzQxz9ZGV5ixnqkzIVF+3tp0ZHgcMKE+VNGHJjEeyFG2dcSw==

"@semantic-release/exec@6.0.3":
version "6.0.3"
resolved "https://registry.yarnpkg.com/@semantic-release/exec/-/exec-6.0.3.tgz#d212fdf19633bdfb553de6cb6c7f8781933224db"
integrity sha512-bxAq8vLOw76aV89vxxICecEa8jfaWwYITw6X74zzlO0mc/Bgieqx9kBRz9z96pHectiTAtsCwsQcUyLYWnp3VQ==
dependencies:
"@semantic-release/error" "^3.0.0"
aggregate-error "^3.0.0"
debug "^4.0.0"
execa "^5.0.0"
lodash "^4.17.4"
parse-json "^5.0.0"

"@semantic-release/git@10.0.1":
version "10.0.1"
resolved "https://registry.yarnpkg.com/@semantic-release/git/-/git-10.0.1.tgz#c646e55d67fae623875bf3a06a634dd434904498"
Expand Down

0 comments on commit 8269bc5

Please sign in to comment.