Skip to content

feat: add react hooks and components #25

feat: add react hooks and components

feat: add react hooks and components #25

Workflow file for this run

name: Auto Build CI
on:
pull_request:
types: [opened, synchronize, reopened]
permissions:
pull-requests: write
contents: write
env:
EM_VERSION: 3.1.51
EM_CACHE_FOLDER: ".emsdk-cache"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Get PR number
id: get-pr-number
uses: mgaitan/gha-get-pr-number@main
- name: Build Start Dispatch
uses: peter-evans/repository-dispatch@v2
with:
event-type: build-start
client-payload: '{ "pr-number": ${{ steps.get-pr-number.outputs.number }} }'
- uses: actions/checkout@v4
- name: Setup system libraries cache
id: cache-system-libraries
uses: actions/cache@v2
with:
path: ${{ env.EM_CACHE_FOLDER }}
key: ${{ env.EM_VERSION }}-${{ runner.os }}
- name: Setup emsdk cache
uses: mymindstorm/setup-emsdk@v13
with:
version: ${{ env.EM_VERSION }}
actions-cache-folder: ${{ env.EM_CACHE_FOLDER }}
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "latest"
cache: "npm"
- name: Get commit ID
id: "commit-id"
run: echo "id=$(git rev-parse --short HEAD)" >> $GITHUB_OUTPUT
- name: Patch package.json
run: npm pkg set version=$(git rev-parse --short HEAD)
- name: Install dependencies
run: npm ci
- name: Build
run: npm run build:all
- name: Pack
run: npm pack
- name: Release
id: "release"
uses: ncipollo/release-action@v1
with:
artifacts: "zxing-wasm-${{ steps.commit-id.outputs.id }}.tgz"
commit: ${{ github.head_ref || github.ref_name }}
tag: "pr-${{ steps.get-pr-number.outputs.number }}-test-package"
allowUpdates: true
- name: Get release url
id: release-url
uses: frabert/replace-string-action@v2
with:
pattern: "^(.+?/releases/)tag(/.+?)$"
string: ${{ steps.release.outputs.html_url }}
replace-with: "$1download$2/zxing-wasm-${{ steps.commit-id.outputs.id }}.tgz"
- name: Build Finish Dispatch
uses: peter-evans/repository-dispatch@v2
with:
event-type: build-finish
client-payload: '{ "release-url": "${{ steps.release-url.outputs.replaced }}", "pr-number": ${{ steps.get-pr-number.outputs.number }} }'
- name: Clean up
if: failure()
uses: peter-evans/repository-dispatch@v2
with:
event-type: build-fail
client-payload: '{ "pr-number": ${{ steps.get-pr-number.outputs.number }} }'