Skip to content

Commit

Permalink
chore: v0.0.1
Browse files Browse the repository at this point in the history
  • Loading branch information
nieyuyao committed Apr 11, 2024
1 parent f9ef144 commit f14a3b1
Show file tree
Hide file tree
Showing 5 changed files with 60 additions and 21 deletions.
18 changes: 2 additions & 16 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,17 @@ name: CI

on:
push:
branches:
- main
- tags
branches: ['main']
pull_request:
branches: ['main']

jobs:
build:
runs-on: ubuntu-latest
environment: release

strategy:
matrix:
node-version: [16.x, 18.x]
node-version: [16.x, 18.x, 20.x]
steps:
- uses: actions/checkout@v4
with:
Expand All @@ -44,14 +41,3 @@ jobs:

- name: test
run: npm run test

release:
if: ${{ startsWith(github.ref, 'refs/tags') && startsWith(github.ref_name, 'v') }}
runs-on: ubuntu-latest
needs: [build]
environment: release
steps:
- name: release
run: npm run release
env:
NPM_AUTH_TOKEN: ${{ vars.NPM_PUBLISH_TOKEN }}
43 changes: 43 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs

name: CI

on:
push:
tags:
- 'v*'

jobs:
release:
if: 'cancelled'
runs-on: ubuntu-latest
environment: release

steps:
- uses: actions/checkout@v4
with:
submodules: true

- name: setup node
uses: actions/setup-node@v4
with:
cache: 'npm'
node-version: 20

- name: install dependencies
run: npm install

- name: setup emscripten
run: cd emsdk && ./emsdk install latest && ./emsdk activate latest && cd ..

- name: build esm
run: npm run build:esm

- name: build cjs
run: npm run build:cjs

- name: release
run: npm run release
env:
NPM_AUTH_TOKEN: ${{ vars.NPM_TOKEN }}
7 changes: 4 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,9 @@
# webp.wasm

webp.wasm is a pure Webassembly / Javascript port of libwebp.
webp.wasm is a pure Webassembly / Javascript port of libwebp. The library supports encoding animated webp.

![CI](https://github.com/nieyuyao/webp-wasm/workflows/CI/badge.svg)
![Release](https://badgen.net/github/release/nieyuyao/webp-wasm/stable)

## APIs

Expand Down Expand Up @@ -72,7 +73,7 @@ const webpData = await encodeRGBA(imgData.data, canvas.width, canvas.height)
...
```

#### encode
#### encode

A more advanced API is based on the WebPConfig. <b>Only the lossless and quality parameters are supported now !!!</b>. You can generate low-quality webp with this function.

Expand Down Expand Up @@ -222,7 +223,7 @@ The image height in pixels.

Raw data in pixels.

> Note: It looks like an `ImageData` object, but it is not. There is actually no `ImageData` in node.
> Note: It has same properties as browser `ImageData` object, but it is not. There is actually no `ImageData` in node.
## Playing Examples

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "wasm-webp",
"version": "0.0.1-beta.2",
"version": "0.0.1",
"description": "",
"main": "dist/cjs/index.js",
"module": "dist/esm/index.js",
Expand Down
11 changes: 10 additions & 1 deletion release.sh
Original file line number Diff line number Diff line change
@@ -1,3 +1,12 @@
echo -e "registry=https://registry.npmjs.org/\n_authToken=$NPM_AUTH_TOKEN" > .npmrc

npm publish --tag beta

# get the version
NODE_VERSION=$(node -p -e "require('./package.json').version")

if [[ $NODE_VERSION =~ "beta" ]]; then
# beta
npm publish --tag beta
else
npm publish
fi

0 comments on commit f14a3b1

Please sign in to comment.