diff --git a/README.md b/README.md index b36c0be..76142c9 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ This actions step downloads emsdk and installs a version of Emscripten. -# Usage +## Usage ```yaml name: "emsdk" @@ -12,26 +12,17 @@ jobs: build: runs-on: ubuntu-latest steps: - - uses: mymindstorm/setup-emsdk@v4 + - uses: mymindstorm/setup-emsdk@v5 - name: Verify run: emcc -v ``` -## Use with actions/cache +## Cache ```yaml -- name: Cache emsdk - uses: actions/cache@v4 - id: cache # This is important! - with: - # Set to the same folder as actions-cache-folder (more below) - path: 'emsdk-cache' - # Set the end bit to emsdk version - key: ${{ runner.os }}-emsdk-1.38.40 - -- name: Setup emsdk (use cache if found, create otherwise) - uses: mymindstorm/setup-emsdk@v2 +- name: Setup emsdk + uses: mymindstorm/setup-emsdk@v5 with: # Make sure to set a version number! version: 1.38.40 @@ -39,15 +30,12 @@ jobs: # The cache folder will be placed in the build directory, # so make sure it doesn't conflict with anything! actions-cache-folder: 'emsdk-cache' - # This stops it from using tc.cacheDir since we are using - # actions/cache. - no-cache: true - name: Verify run: emcc -v ``` -# Options +## Options ```yaml version: @@ -60,7 +48,7 @@ no-cache: description: "If true will not cache any downloads with tc.cacheDir." default: false actions-cache-folder: - description: "Set to the folder where your cached emsdk-master folder is or where emsdk cache will be copied to on sucessful run. This folder will go under $GITHUB_HOME (I.e. build dir)." + description: "Directory to cache emsdk in. This folder will go under $GITHUB_HOME (I.e. build dir) and be cached using @actions/cahce." default: '' update-tags: description: "Update tags before installing a version" diff --git a/action.yml b/action.yml index 5011c4d..3ccee52 100644 --- a/action.yml +++ b/action.yml @@ -12,7 +12,7 @@ inputs: description: "If true will not cache any downloads with tc.cacheDir." default: false actions-cache-folder: - description: "Set to the folder where your cached emsdk-master folder is or where emsdk cache will be copied to on sucessful run. This folder will go under $GITHUB_HOME (I.e. build dir)." + description: "Directory to cache emsdk in. This folder will go under $GITHUB_HOME (I.e. build dir) and be cached using @actions/cahce." default: '' update-tags: description: "Update tags before installing a version" diff --git a/src/main.ts b/src/main.ts index cf2b7b3..acd4a36 100644 --- a/src/main.ts +++ b/src/main.ts @@ -18,7 +18,7 @@ async function run() { let emsdkFolder; let foundInCache = false; - if (emArgs.version !== "latest" && emArgs.noCache === "false") { + if (emArgs.version !== "latest" && emArgs.noCache === "false" && !emArgs.actionsCacheFolder) { emsdkFolder = await tc.find('emsdk', emArgs.version, os.arch()); } @@ -68,7 +68,7 @@ async function run() { await exec.exec(`${emsdk} install ${emArgs.version}`); - if (emArgs.version !== "latest" && emArgs.version !== "tot" && emArgs.noCache === "false") { + if (emArgs.version !== "latest" && emArgs.version !== "tot" && emArgs.noCache === "false" && !emArgs.actionsCacheFolder) { await tc.cacheDir(emsdkFolder, 'emsdk', emArgs.version, os.arch()); } }