Build and Release #53
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
name: Build and Release | |
on: | |
push: | |
tags: | |
- "@ic-reactor/core" | |
workflow_dispatch: | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4.1.2 | |
with: | |
token: ${{ secrets.RELEASE_TOKEN }} | |
ref: main | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: "20.9.0" | |
cache: "yarn" | |
- name: Setup Yarn | |
run: yarn install | |
- name: Build | |
run: yarn build | |
- name: Get Core Package Version | |
id: core-version | |
run: echo "CORE_VERSION=$(jq -r '.version' ./packages/core/package.json)" >> $GITHUB_ENV | |
- name: Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
token: ${{ secrets.RELEASE_TOKEN }} | |
name: "Core Bundle v${{ env.CORE_VERSION }}" | |
tag_name: "v${{ env.CORE_VERSION }}" | |
body: | | |
For production use: | |
```html | |
<script src="https://github.com/B3Pay/ic-reactor/releases/download/v${{ env.CORE_VERSION }}/ic-reactor-core.min.js"></script> | |
``` | |
For development use: | |
```html | |
<script src="https://github.com/B3Pay/ic-reactor/releases/download/v${{ env.CORE_VERSION }}/ic-reactor-core.js"></script> | |
``` | |
Parser WebAssembly file: | |
```html | |
<script src="https://github.com/B3Pay/ic-reactor/releases/download/v${{ env.CORE_VERSION }}/index_bg.wasm"></script> | |
``` | |
files: | | |
./packages/parser/dist/web/index_bg.wasm | |
./packages/core/umd/production/ic-reactor-core.min.js | |
./packages/core/umd/development/ic-reactor-core.js | |
./packages/core/umd/development/ic-reactor-core.js.map | |
draft: false | |
prerelease: false | |
generate_release_notes: true | |
- name: Manually Checkout to a Branch | |
run: | | |
git checkout main || git switch -c main | |
git pull origin main | |
- name: Update README.md | |
run: | | |
sed -i "s/releases\/download\/.*\/ic-reactor-core.min.js/releases\/download\/v${CORE_VERSION}\/ic-reactor-core.min.js/" ./packages/core/README.md | |
- name: Add & Commit | |
uses: EndBug/add-and-commit@v9 | |
with: | |
add: "./packages/core/README.md" | |
default_author: github_actions | |
message: "Update README.md to point to the latest release(v${{ env.CORE_VERSION }})" |