refactor: improve code readability (#17) #53
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: Release bundle to package manager | |
on: | |
pull_request: | |
branches: [master] | |
push: | |
branches: [master] | |
permissions: | |
id-token: write # to enable use of OIDC for npm provenance | |
contents: write | |
issues: write | |
pull-requests: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/iron' | |
cache: 'npm' | |
# - name: Cache | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# node_modules | |
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
- name: Install dependensies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Upload dist | |
uses: actions/upload-artifact@v4 | |
with: | |
name: dist | |
path: | | |
dist/ | |
tests: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/iron' | |
cache: 'npm' | |
- name: Install dependensies | |
run: npm ci | |
# - name: Cache | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# node_modules | |
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
- name: Eslint | |
run: npm run lint | |
- name: Prettier | |
run: npm run format | |
- name: Typescript | |
run: npm run type:check | |
- name: Testing | |
run: npx vitest --coverage.enabled true | |
- name: 'Report Coverage' | |
uses: davelosert/vitest-coverage-report-action@v2 | |
release: | |
needs: tests | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 'lts/iron' | |
cache: 'npm' | |
- name: Install dependensies | |
run: npm ci | |
# - name: Cache | |
# uses: actions/cache@v4 | |
# with: | |
# path: | | |
# node_modules | |
# key: ${{ runner.os }}-node-${{ hashFiles('**/package-lock.json') }} | |
- name: Download Artifact | |
uses: actions/download-artifact@v4 | |
with: | |
name: dist | |
path: ./dist | |
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies | |
run: npm audit signatures | |
- name: Release | |
env: | |
HUSKY: 0 | |
NPM_TOKEN: ${{ secrets.NPM_TOKEN_RELEASE }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: npx semantic-release |