perf(uniq): improve performance (#1358) #1602
This file contains hidden or 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: Release | |
on: | |
push: | |
branches: | |
- main | |
tags: | |
- 'v*.*.*' | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
permissions: | |
id-token: write | |
contents: write | |
deployments: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- run: corepack enable | |
- uses: actions/setup-node@v5 | |
with: | |
cache: 'yarn' | |
cache-dependency-path: 'yarn.lock' | |
node-version-file: '.nvmrc' | |
- name: Update npm | |
run: npm install -g [email protected] | |
- uses: denoland/setup-deno@v2 | |
with: | |
deno-version: v1.x | |
- name: Check environment | |
run: | | |
node -v | |
npm -v | |
yarn -v | |
- if: github.ref_type == 'branch' | |
run: | | |
jq \ | |
--arg build "$GITHUB_RUN_NUMBER" \ | |
--arg commit "${GITHUB_SHA::8}" \ | |
'.version = .version + "-dev." + $build + "+" + $commit' \ | |
package.json > package.json.tmp | |
mv package.json.tmp package.json | |
jq \ | |
--arg build "$GITHUB_RUN_NUMBER" \ | |
--arg commit "${GITHUB_SHA::8}" \ | |
'.version = .version + "-dev." + $build + "+" + $commit' \ | |
jsr.json > jsr.json.tmp | |
mv jsr.json.tmp jsr.json | |
- run: yarn install | |
- run: 'mkdir -p out && yarn pack --out out/%s-%v.tgz' | |
- name: Check Package Entrypoints | |
run: 'yarn attw out/*.tgz' | |
- id: extract-changelog | |
uses: dahlia/submark@5a5ff0a58382fb812616a5801402f5aef00f90ce | |
with: | |
input-file: CHANGELOG.md | |
heading-level: 2 | |
heading-title-text: version ${{ github.ref_name }} | |
ignore-case: true | |
omit-heading: true | |
- run: 'cat ${{ steps.extract-changelog.outputs.output-file }}' | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
if: startsWith(github.ref, 'refs/tags/') | |
with: | |
body_path: ${{ steps.extract-changelog.outputs.output-file }} | |
repository: toss/es-toolkit | |
generate_release_notes: false | |
token: ${{ secrets.GITHUB_TOKEN }} | |
files: out/*.tgz | |
- name: Publish to registry | |
if: | | |
github.event_name == 'push' && | |
(github.ref_type == 'tag' || github.ref == 'refs/heads/main') | |
run: | | |
set -ex | |
if [[ "$GITHUB_REF_TYPE" = "tag" ]]; then | |
npm publish --provenance --access public *.tgz | |
else | |
npm publish --provenance --access public --tag dev *.tgz | |
fi | |
deno publish --allow-dirty --unstable-sloppy-imports | |
working-directory: ${{ github.workspace }}/out/ | |
deploy-docs: | |
if: github.event_name == 'push' && github.ref_type == 'tag' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v5 | |
- run: corepack enable | |
- uses: actions/setup-node@v5 | |
with: | |
cache: 'yarn' | |
cache-dependency-path: 'yarn.lock' | |
node-version-file: '.nvmrc' | |
- name: Install dependencies | |
run: yarn install | |
- name: Deploy a docs site | |
run: yarn vercel deploy --yes --prod --token=${{ secrets.VERCEL_TOKEN }} |