chore(deps): update all non-major dependencies with stable version (minor) #2144
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
name: Tests | |
on: | |
pull_request: | |
types: | |
- opened | |
- synchronize | |
- reopened | |
- labeled | |
branches: | |
- main | |
- alpha | |
- beta | |
# Allow calling manually from GitHub | |
workflow_dispatch: | |
# Allow workflow to be called by another workflow | |
workflow_call: | |
jobs: | |
test: | |
name: Run Tests | |
runs-on: ubuntu-latest | |
timeout-minutes: 20 | |
env: | |
GITHUB_TOKEN: ${{ secrets.KONGPONENTS_BOT_PAT }} | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN_PUBLIC_PUBLISH }} | |
steps: | |
- name: Remove preview consumption comment | |
if: ${{ github.event_name == 'pull_request' && env.GITHUB_TOKEN != '' }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: pr_preview_consumption | |
delete: true | |
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Use Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version-file: '.nvmrc' | |
- name: Setup PNPM with Dependencies | |
uses: ./.github/actions/setup-pnpm-with-dependencies/ | |
with: | |
force-install: true | |
- name: Lint and Build | |
run: pnpm build | |
- name: Unit and Component Tests | |
run: pnpm test | |
- name: Publish package preview | |
id: package-preview | |
# Do not run for `alpha` or `beta` branches | |
if: github.event_name == 'pull_request' && env.NPM_TOKEN != '' && (github.actor != 'renovate[bot]' || contains(github.event.pull_request.labels.*.name, 'create preview package')) && !contains(github.head_ref || github.ref_name, 'alpha') && !contains(github.head_ref || github.ref_name, 'beta') | |
env: | |
NPM_TOKEN: ${{ env.NPM_TOKEN }} | |
run: | | |
git config user.email "[email protected]" | |
git config user.name "Kong UI Bot" | |
preid="pr.${{ github.event.pull_request.number }}.$(git rev-parse --short ${{ github.event.pull_request.head.sha }})" | |
tag="pr-${{ github.event.pull_request.number }}" | |
echo "preid=${preid}" | |
echo "//registry.npmjs.org/:_authToken=${NPM_TOKEN}" > .npmrc | |
pnpm version prerelease --preid ${preid} --no-git-tag-version --yes --amend | |
package_version=$(jq -r ".version" package.json) | |
package=@kong/icons@"${package_version}" | |
npm show "${package}" >/dev/null 2>&1 && npm_show_status=0 || npm_show_status=1 | |
if [ $npm_show_status -eq 0 ]; then | |
echo "Package ${package} is already published. Skipping publishing." | |
exit 0 | |
fi | |
npm_instructions="" | |
pkg=$(npm publish --no-git-checks --access public --report-summary --tag "${tag}" | grep "+ "| sed 's/+ //') | |
if [[ -z "${pkg}" ]]; then | |
echo "Error publishing package" | |
exit -1 | |
fi | |
npm_instructions="pnpm add @$(echo ${pkg}|cut -d'@' -f2)@${tag}" | |
echo "npm_instructions<<EOF" >> $GITHUB_OUTPUT | |
echo -e "$npm_instructions" >> $GITHUB_OUTPUT | |
echo "EOF" >> $GITHUB_OUTPUT | |
- name: Provide preview link info | |
if: ${{ steps.package-preview.outputs.npm_instructions != '' && env.GITHUB_TOKEN != '' }} | |
uses: marocchino/sticky-pull-request-comment@v2 | |
with: | |
header: pr_preview_consumption | |
message: | | |
### Install the preview package from this PR in your consuming application | |
In your host project, you may install the preview package version generated by this PR: | |
```sh | |
${{ steps.package-preview.outputs.npm_instructions }} | |
``` | |
GITHUB_TOKEN: ${{ env.GITHUB_TOKEN }} |