From 33c188f7701bbb6ca32ba6c17e9b9e23177ebe2c Mon Sep 17 00:00:00 2001 From: ryohidaka <39184410+ryohidaka@users.noreply.github.com> Date: Sat, 7 Sep 2024 15:14:48 +0900 Subject: [PATCH] feat: Add root-path option. --- action.yml | 13 +++++++++---- scripts/install_dependencies.sh | 1 + scripts/submit_to_chrome.sh | 3 ++- scripts/submit_to_edge.sh | 3 ++- scripts/submit_to_firefox.sh | 3 ++- 5 files changed, 16 insertions(+), 7 deletions(-) diff --git a/action.yml b/action.yml index b35ec0d..822d452 100644 --- a/action.yml +++ b/action.yml @@ -10,6 +10,10 @@ inputs: description: "Dry Run Flag" required: false default: false + root-path: + description: "The root path of the wxt project. Default is the current directory." + required: false + default: "." # Inputs for Chrome Extension chrome: @@ -79,14 +83,15 @@ runs: with: node-version: latest cache: "pnpm" + cache-dependency-path: ${{ inputs.root-path }} - name: Install dependencies - run: scripts/install_dependencies.sh + run: scripts/install_dependencies.sh "${{ inputs.root-path }}" shell: bash - name: Submit to Chrome if: ${{ inputs.chrome == 'true' }} - run: scripts/submit_to_chrome.sh "${{ inputs.dry-run }}" + run: scripts/submit_to_chrome.sh "${{ inputs.root-path }}" "${{ inputs.dry-run }}" shell: bash env: CHROME_EXTENSION_ID: ${{ inputs.chrome-extension-id }} @@ -96,7 +101,7 @@ runs: - name: Submit to Firefox if: ${{ inputs.firefox == 'true' }} - run: scripts/submit_to_firefox.sh "${{ inputs.dry-run }}" + run: scripts/submit_to_firefox.sh "${{ inputs.root-path }}" "${{ inputs.dry-run }}" shell: bash env: FIREFOX_EXTENSION_ID: ${{ inputs.firefox-extension-id }} @@ -105,7 +110,7 @@ runs: - name: Submit to Edge if: ${{ inputs.edge == 'true' }} - run: scripts/submit_to_edge.sh "${{ inputs.dry-run }}" + run: scripts/submit_to_edge.sh "${{ inputs.root-path }}" "${{ inputs.dry-run }}" shell: bash env: EDGE_PRODUCT_ID: ${{ inputs.edge-product-id }} diff --git a/scripts/install_dependencies.sh b/scripts/install_dependencies.sh index da8e497..a8ac1f5 100755 --- a/scripts/install_dependencies.sh +++ b/scripts/install_dependencies.sh @@ -1,5 +1,6 @@ #!/bin/bash echo "::group::Install dependencies" +cd "$1" || exit 1 pnpm install echo "::endgroup::" diff --git a/scripts/submit_to_chrome.sh b/scripts/submit_to_chrome.sh index 3e3c367..bae32ab 100755 --- a/scripts/submit_to_chrome.sh +++ b/scripts/submit_to_chrome.sh @@ -1,8 +1,9 @@ #!/bin/bash echo "::group::Submit to Chrome" +cd "$1" || exit 1 pnpm zip pnpm wxt submit \ - $([ "$1" == 'true' ] && echo "--dry-run") \ + $([ "$2" == 'true' ] && echo "--dry-run") \ --chrome-zip .output/*-chrome.zip echo "::endgroup::" diff --git a/scripts/submit_to_edge.sh b/scripts/submit_to_edge.sh index 70ba48a..3f0edf8 100755 --- a/scripts/submit_to_edge.sh +++ b/scripts/submit_to_edge.sh @@ -1,8 +1,9 @@ #!/bin/bash echo "::group::Submit to Edge" +cd "$1" || exit 1 pnpm zip pnpm wxt submit \ - $([ "$1" == 'true' ] && echo "--dry-run") \ + $([ "$2" == 'true' ] && echo "--dry-run") \ --edge-zip .output/*-chrome.zip echo "::endgroup::" diff --git a/scripts/submit_to_firefox.sh b/scripts/submit_to_firefox.sh index adaa1b7..107eb08 100755 --- a/scripts/submit_to_firefox.sh +++ b/scripts/submit_to_firefox.sh @@ -1,8 +1,9 @@ #!/bin/bash echo "::group::Submit to Firefox" +cd "$1" || exit 1 pnpm zip:firefox pnpm wxt submit \ - $([ "$1" == 'true' ] && echo "--dry-run") \ + $([ "$2" == 'true' ] && echo "--dry-run") \ --firefox-zip .output/*-firefox.zip --firefox-sources-zip .output/*-sources.zip echo "::endgroup::"