chore: move hoverstate hook to lib (#1154) #138
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: Publish | |
on: | |
push: | |
branches: | |
- main | |
env: | |
NODE_VERSION: 20.4.0 | |
PNPM_VERSION: 8 | |
jobs: | |
publish: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read # this is needed by version-metadata | |
pull-requests: read # this is needed by version-metadata | |
steps: | |
# General actions setup (checkout, pnpm, node, caching) | |
- uses: actions/checkout@v4 | |
- uses: pnpm/action-setup@v2 | |
id: pnpm-install | |
with: | |
version: ${{ env.PNPM_VERSION }} | |
run_install: false | |
- name: Setup pnpm | |
uses: actions/setup-node@v4 | |
with: | |
node-version: ${{ env.NODE_VERSION }} | |
registry-url: "https://registry.npmjs.org" | |
scope: "@helpwave" | |
- name: Get pnpm cache directory | |
id: pnpm-cache | |
shell: bash | |
run: | | |
echo "directory=$(pnpm store path)" >> $GITHUB_OUTPUT | |
- name: Cache pnpm dependencies | |
uses: actions/cache@v3 | |
with: | |
path: ${{ steps.pnpm-cache.outputs.directory }} | |
key: ${{ runner.os }}-pnpm-cache-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-cache- | |
# Publishing specific steps | |
- name: Determine last published version of @helpwave/eslint-config | |
run: | | |
set +e # disable pipefail, error handling is done manually below | |
# get version or fall back to `0.0.0` if the package doesn't exist (yet) | |
echo "NPM_PUBLISHED_VERSION_ESLINT=$(npm show @helpwave/eslint-config version || echo "0.0.0")" >> $GITHUB_ENV | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- id: version-metadata-eslint | |
uses: Quantco/ui-actions/[email protected] | |
with: | |
file: "eslint-config/package.json" | |
token: ${{ secrets.GITHUB_TOKEN }} | |
- id: publish-eslint | |
uses: Quantco/ui-actions/[email protected] | |
with: | |
increment-type: minor | |
relevant-files: '[".github/**", "eslint-config/**"]' | |
package-json-file-path: lib/package.json | |
latest-registry-version: ${{ env.NPM_PUBLISHED_VERSION_ESLINT }} | |
version-metadata-json: ${{ steps.version-metadata-eslint.outputs.json }} | |
- run: | | |
echo "### Version metadata for @helpwave/eslint-config" | |
echo "" | |
echo "npm latest version: $NPM_PUBLISHED_VERSION_ESLINT" | |
echo "json (version-metadata): $VERSION_METADATA_JSON_ESLINT" | |
echo "json (publish) $PUBLISH_JSON_ESLINT" | |
env: | |
VERSION_METADATA_JSON_ESLINT: ${{ steps.version-metadata-eslint.outputs.json }} | |
PUBLISH_JSON_ESLINT: ${{ steps.publish-eslint.outputs.json }} | |
- if: steps.publish-eslint.outputs.publish == 'true' | |
run: pnpm install | |
- if: steps.publish-eslint.outputs.publish == 'true' | |
run: | | |
echo "Publishing version ${{ steps.publish-eslint.outputs.version }}" | |
pnpm --filter @helpwave/eslint-config exec npm version --git-tag-version false --allow-same-version true ${{ steps.publish-eslint.outputs.version }} | |
pnpm publish --filter @helpwave/eslint-config --no-git-checks --access public | |
env: | |
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | |
- name: Create action summary | |
run: | | |
echo "$SUMMARY_ESLINT" >> $GITHUB_STEP_SUMMARY | |
env: | |
SUMMARY_ESLINT: ${{ steps.publish-eslint.outputs.reason }} |