Skip to content

workflow fix permissions #146

workflow fix permissions

workflow fix permissions #146

Workflow file for this run

name: "Build"
on:
push:
env:
EM_VERSION: 4.0.9
EM_CACHE_FOLDER: "emsdk-cache"
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v7
with:
submodules: "true"
- name: Install pnpm
uses: pnpm/setup@v2
with:
cache: true
- name: Get subrepo revisions
shell: bash
run: |
echo "OCGCORE_REV=$(git -C cpp/ygo rev-parse HEAD)" >> $GITHUB_ENV
echo "LUA_REV=$(git -C cpp/lua rev-parse HEAD)" >> $GITHUB_ENV
- name: Cache wasm build
id: cache-wasm
uses: actions/cache@v3
with:
path: lib
key: ocgcore-build-${{env.EM_VERSION}}-${{ hashFiles('scripts/build.sh') }}-${{ hashFiles('cpp/wasm.cpp') }}-${{ env.OCGCORE_REV }}-${{ env.LUA_REV }}
- name: Cache emsdk
if: ${{ steps.cache-wasm.outputs.cache-hit != 'true' }}
id: cache-emsdk
uses: actions/cache@v3
with:
path: ${{env.EM_CACHE_FOLDER}}
key: ${{env.EM_VERSION}}-${{ runner.os }}
- name: Setup emsdk
if: ${{ steps.cache-wasm.outputs.cache-hit != 'true' }}
uses: mymindstorm/setup-emsdk@v14
with:
version: ${{env.EM_VERSION}}
actions-cache-folder: ${{env.EM_CACHE_FOLDER}}
- name: Build wasm
if: ${{ steps.cache-wasm.outputs.cache-hit != 'true' }}
run: |
chmod a+x ./scripts/build.sh
./scripts/build.sh
- name: Build Library
run: pnpm run build:lib
- name: Build Types
run: pnpm run build:types
- name: Upload Artifacts
uses: actions/upload-artifact@v4
with:
name: package
path: |
README.md
src
lib
dist
package.json
release:
runs-on: ubuntu-latest
needs: build
permissions:
contents: read
id-token: write
if: github.ref == 'refs/heads/release'
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install pnpm
uses: pnpm/setup@v2
with:
install: false
cache: true
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: package
- name: pnpm Publish
run: pnpm publish --publish-branch release
release-jsr:
runs-on: ubuntu-latest
permissions:
contents: read
id-token: write
needs: build
if: github.ref == 'refs/heads/release'
steps:
- name: Checkout
uses: actions/checkout@v7
- name: Install Node.js
uses: actions/setup-node@v7
with:
node-version: 22
registry-url: "https://registry.npmjs.org"
- name: Download Artifacts
uses: actions/download-artifact@v4
with:
name: package
- name: Publish on jsr
run: npx jsr publish