mirror of
https://github.com/emn178/js-md5.git
synced 2026-08-12 20:31:43 +08:00
### Added
- Modern and lite builds generated from the same source. - support ESM. - Set up GitHub release action / provenance ### Fixed - Fix uploading coverage to coveralls - fix recognize environment is node when use browserfs
This commit is contained in:
@@ -0,0 +1,44 @@
|
||||
name: CI
|
||||
|
||||
on:
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
pull_request:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
ci:
|
||||
runs-on: ubuntu-latest
|
||||
strategy:
|
||||
matrix:
|
||||
node-version: [16.x, 18.x, 20.x, 22.x]
|
||||
steps:
|
||||
- name: Checkout code
|
||||
uses: actions/checkout@v4
|
||||
|
||||
- name: Set up Node ${{ matrix.node-version }}
|
||||
uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: ${{ matrix.node-version }}
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Build
|
||||
if: matrix.node-version == '22.x'
|
||||
run: npm run build
|
||||
|
||||
- name: Run tests
|
||||
run: npm test
|
||||
|
||||
- name: Generate coverage report
|
||||
if: matrix.node-version == '22.x'
|
||||
run: npm run coverage
|
||||
|
||||
- name: Upload to coveralls
|
||||
if: matrix.node-version == '22.x'
|
||||
uses: coverallsapp/github-action@v2
|
||||
with:
|
||||
file: ./coverage.lcov
|
||||
@@ -0,0 +1,32 @@
|
||||
name: Publish
|
||||
|
||||
on:
|
||||
release:
|
||||
types: [published]
|
||||
|
||||
permissions:
|
||||
contents: read
|
||||
id-token: write
|
||||
|
||||
jobs:
|
||||
publish:
|
||||
runs-on: ubuntu-latest
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
|
||||
- uses: actions/setup-node@v4
|
||||
with:
|
||||
node-version: 24.x
|
||||
registry-url: https://registry.npmjs.org
|
||||
package-manager-cache: false
|
||||
|
||||
- run: npm ci
|
||||
|
||||
- name: Verify release version
|
||||
run: |
|
||||
PACKAGE_VERSION=$(node -p "require('./package.json').version")
|
||||
test "$GITHUB_REF_NAME" = "v$PACKAGE_VERSION"
|
||||
|
||||
- run: npm run build
|
||||
- run: npm test
|
||||
- run: npm publish
|
||||
Reference in New Issue
Block a user