-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
3 changed files
with
105 additions
and
1 deletion.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
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 }} }' |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,22 @@ | ||
name: Delete CI Releases | ||
|
||
on: | ||
pull_request: | ||
types: [closed] | ||
|
||
permissions: | ||
pull-requests: write | ||
contents: write | ||
|
||
jobs: | ||
build: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Get PR number | ||
id: get-pr-number | ||
uses: mgaitan/gha-get-pr-number@main | ||
- name: Delete CI releases | ||
uses: dev-drprasad/[email protected] | ||
with: | ||
keep_latest: 0 | ||
delete_tag_pattern: pr-${{ steps.get-pr-number.outputs.number }}-test-package |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -29,4 +29,6 @@ docs | |
build | ||
coverage | ||
src/**/zxing_*.wasm | ||
src/**/zxing_*.js | ||
src/**/zxing_*.js | ||
|
||
.emsdk-cache |