fix: update code follow linter suggestion #18
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 Explorer UI | |
on: | |
push: | |
branches: | |
- master | |
pull_request: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
jobs: | |
build_explorer: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Set up Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '21' | |
- name: Set up pnpm | |
uses: pnpm/action-setup@v4 | |
with: | |
standalone: true | |
package_json_file: 'ui/package.json' | |
version: latest | |
- name: Get pnpm store directory | |
shell: bash | |
run: | | |
echo "STORE_PATH=$(pnpm store path --silent)" >> $GITHUB_ENV | |
- uses: actions/cache@v4 | |
name: Setup pnpm cache | |
with: | |
path: ${{ env.STORE_PATH }} | |
key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} | |
restore-keys: | | |
${{ runner.os }}-pnpm-store- | |
- name: Setup Go | |
uses: actions/setup-go@v5 | |
with: | |
go-version-file: "go.mod" | |
cache: true | |
check-latest: true | |
- name: Setup Python | |
uses: actions/setup-python@v5 | |
with: | |
python-version: '3.12' | |
check-latest: true | |
cache: 'pip' | |
cache-dependency-path: 'scripts/requirements.txt' | |
- name: Install node dependencies | |
working-directory: ./ui | |
run: | | |
pnpm install | |
- name: Setup Binaryen | |
# fixme: use acifani/setup-tinygo after pr acceptance | |
uses: Zxilly/setup-tinygo@main | |
with: | |
install-tinygo: false | |
binaryen-version: '117' | |
- name: Add python dependencies | |
run: | | |
pip install -r scripts/requirements.txt | |
- name: Download deps | |
run: go mod download | |
- name: Build wasm | |
run: | | |
python scripts/wasm.py | |
- name: Build | |
working-directory: ./ui | |
run: pnpm run build:explorer | |
env: | |
CODECOV_TOKEN: ${{ secrets.CODECOV_TOKEN }} | |
PULL_REQUEST_COMMIT_SHA: ${{ github.event.pull_request.head.sha }} | |
- name: Upload pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: 'ui/dist/explorer/' | |
deploy: | |
if: ${{ github.event_name == 'push' }} | |
needs: build_explorer | |
environment: | |
name: github-pages | |
url: ${{ steps.deployment.outputs.page_url }} | |
runs-on: ubuntu-latest | |
steps: | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 | |