Skip to content

Commit

Permalink
feat: Enable workflow command.
Browse files Browse the repository at this point in the history
  • Loading branch information
ryohidaka committed Apr 18, 2024
1 parent 4b73213 commit 1e94cd6
Showing 1 changed file with 42 additions and 17 deletions.
59 changes: 42 additions & 17 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -53,72 +53,88 @@ runs:
- name: Check if Dryrun is enabled
run: |
if [ "${{ inputs.dry-run }}" == 'true' ]; then
echo "Dryrun mode is enabled"
echo "::notice:: Dryrun mode is enabled"
else
echo "Dryrun mode is disabled"
echo "::notice:: Dryrun mode is disabled"
fi
shell: bash

- name: Check required inputs for Chrome Extension
if: ${{ inputs.chrome == 'true' }}
run: |
echo "::group::Check required inputs for Chrome Extension"
if [[ -z "${{ inputs.chrome-extension-id }}" ]]; then
echo "Error: Chrome Extension ID is required."
echo "::error:: Chrome Extension ID is required."
exit 1
fi
if [[ -z "${{ inputs.chrome-client-id }}" ]]; then
echo "Error: Chrome Client ID is required."
echo "::error:: Chrome Client ID is required."
exit 1
fi
if [[ -z "${{ inputs.chrome-client-secret }}" ]]; then
echo "Error: Chrome Client Secret is required."
echo "::error:: Chrome Client Secret is required."
exit 1
fi
if [[ -z "${{ inputs.chrome-refresh-token }}" ]]; then
echo "Error: Chrome Refresh Token is required."
echo "::error:: Chrome Refresh Token is required."
exit 1
fi
echo "All required inputs for Chrome Extension are provided."
echo "::notice:: All required inputs for Chrome Extension are provided."
echo "::endgroup::"
shell: bash

- name: Check required inputs for Firfox Addon
if: ${{ inputs.firefox == 'true' }}
run: |
echo "::group::Check required inputs for Firfox Addon"
if [[ -z "${{ inputs.firefox-extension-id }}" ]]; then
echo "Error: Firefox Extension ID is required."
echo "::error:: Firefox Extension ID is required."
exit 1
fi
if [[ -z "${{ inputs.firefox-jwt-issuer }}" ]]; then
echo "Error: Firefox JWT Issuer is required."
echo "::error:: Firefox JWT Issuer is required."
exit 1
fi
if [[ -z "${{ inputs.firefox-jwt-secret }}" ]]; then
echo "Error: Firefox JWT Secret is required."
echo "::error:: Firefox JWT Secret is required."
exit 1
fi
echo "All required inputs for Chrome Extension are provided."
echo "::notice:: All required inputs for Firefox Addon are provided."
echo "::endgroup::"
shell: bash

- name: Check required inputs for Edge Extension
if: ${{ inputs.edge == 'true' }}
run: |
echo "::group::Check required inputs for Edge Extension"
if [[ -z "${{ inputs.edge-product-id }}" ]]; then
echo "Error: Edge Product ID is required."
echo "::error:: Edge Product ID is required."
exit 1
fi
if [[ -z "${{ inputs.edge-client-id }}" ]]; then
echo "Error: Edge Client ID is required."
echo "::error:: Edge Client ID is required."
exit 1
fi
if [[ -z "${{ inputs.edge-client-secret }}" ]]; then
echo "Error: Edge Client Secret is required."
echo "::error:: Edge Client Secret is required."
exit 1
fi
if [[ -z "${{ inputs.edge-access-token-url }}" ]]; then
echo "Error: Edge Access Token URL is required."
echo "::error:: Edge Access Token URL is required."
exit 1
fi
echo "All required inputs for Edge Extension are provided."
echo "::notice:: All required inputs for Edge Extension are provided."
echo "::endgroup::"
shell: bash

- uses: actions/checkout@v4
Expand All @@ -133,16 +149,21 @@ runs:
cache: "pnpm"

- name: Install dependencies
run: pnpm install
run: |
echo "::group::Install dependencies"
pnpm install
echo "::endgroup::"
shell: bash

- name: Submit to Chrome
if: ${{ inputs.chrome == 'true' }}
run: |
echo "::group::Submit to Chrome"
pnpm zip
pnpm wxt submit \
${{ inputs.dry-run == 'true' && '--dry-run' || '' }} \
--chrome-zip .output/*-chrome.zip
echo "::endgroup::"
shell: bash
env:
CHROME_EXTENSION_ID: ${{ inputs.chrome-extension-id }}
Expand All @@ -153,10 +174,12 @@ runs:
- name: Submit to Firefox
if: ${{ inputs.firefox == 'true' }}
run: |
echo "::group::Submit to Firefox"
pnpm zip:firefox
pnpm wxt submit \
${{ inputs.dry-run == 'true' && '--dry-run' || '' }} \
--firefox-zip .output/*-firefox.zip --firefox-sources-zip .output/*-sources.zip
echo "::endgroup::"
shell: bash
env:
FIREFOX_EXTENSION_ID: ${{ inputs.firefox-extension-id }}
Expand All @@ -166,10 +189,12 @@ runs:
- name: Submit to Edge
if: ${{ inputs.edge == 'true' }}
run: |
echo "::group::Submit to Edge"
pnpm zip
pnpm wxt submit \
${{ inputs.dry-run == 'true' && '--dry-run' || '' }} \
--edge-zip .output/*-chrome.zip
echo "::endgroup::"
shell: bash
env:
EDGE_PRODUCT_ID: ${{ inputs.edge-product-id }}
Expand Down

0 comments on commit 1e94cd6

Please sign in to comment.