Skip to content

chore(ci): add ci

chore(ci): add ci #10

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: Build Start Dispatch
uses: peter-evans/repository-dispatch@v2
with:
event-type: build-start
- 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 "COMMIT_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.commit_id }}.tgz"
commit: ${{ github.head_ref || github.ref_name }}
tag: ${{ steps.commit_id.outputs.commit_id }}
allowUpdates: true
- name: Build Finish Dispatch
uses: peter-evans/repository-dispatch@v2
with:
event-type: build-finish
client-payload: '{ "release-url": "${{steps.release.outputs.html_url}}" }'