Skip to content

Commit

Permalink
Fixed space char on args
Browse files Browse the repository at this point in the history
  • Loading branch information
bayrakmustafa committed Apr 25, 2024
1 parent 4e23356 commit a670fec
Show file tree
Hide file tree
Showing 5 changed files with 25 additions and 7 deletions.
10 changes: 7 additions & 3 deletions .github/workflows/docker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -130,7 +130,9 @@ jobs:
mkdir ${GITHUB_WORKSPACE}/artifacts
- name: Sign Example PS1 File
run: docker run -i --rm --volume ${GITHUB_WORKSPACE}/artifacts:/codesign/output --env-file .env ${{ env.LINUX_DOCKER_IMAGE_NAME }} sign -input_file_path=/codesign/examples/codesign.ps1 -output_dir_path=/codesign/output
run: |
docker run -i --rm --volume ${GITHUB_WORKSPACE}/artifacts:/codesign/output --env-file .env ${{ env.LINUX_DOCKER_IMAGE_NAME }} sign -input_file_path="/codesign/examples/codesign.ps1" -output_dir_path=/codesign/output
docker run -i --rm --volume ${GITHUB_WORKSPACE}/artifacts:/codesign/output --env-file .env ${{ env.LINUX_DOCKER_IMAGE_NAME }} sign -input_file_path="/codesign/examples/codesign\ \(1\).ps1" -output_dir_path=/codesign/output
- name: Upload Signed Files
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -171,7 +173,8 @@ jobs:
- name: Sign Example PS1 File
shell: powershell
run: |
docker run -i --rm --volume .\artifacts:C:\CodeSignTool\output --env-file .env ${{ env.WINDOWS_DOCKER_IMAGE_NAME }} sign ``-input_file_path=C:\CodeSignTool\examples\codesign.ps1 ``-output_dir_path=C:\CodeSignTool\output
docker run -i --rm --volume .\artifacts:C:\CodeSignTool\output --env-file .env ${{ env.WINDOWS_DOCKER_IMAGE_NAME }} sign ``-input_file_path="C:\CodeSignTool\examples\codesign.ps1" ``-output_dir_path=C:\CodeSignTool\output
docker run -i --rm --volume .\artifacts:C:\CodeSignTool\output --env-file .env ${{ env.WINDOWS_DOCKER_IMAGE_NAME }} sign ``-input_file_path="C:\CodeSignTool\examples\codesign`` ``(1``).ps1" ``-output_dir_path=C:\CodeSignTool\output
- name: Upload Signed Files
uses: actions/upload-artifact@v3
Expand Down Expand Up @@ -212,7 +215,8 @@ jobs:
- name: Sign Example PS1 File
shell: powershell
run: |
docker run -i --rm --volume .\artifacts:C:\CodeSignTool\output --env-file .env ${{ env.WINDOWS_2019_DOCKER_IMAGE_NAME }} sign ``-input_file_path=C:\CodeSignTool\examples\codesign.ps1 ``-output_dir_path=C:\CodeSignTool\output
docker run -i --rm --volume .\artifacts:C:\CodeSignTool\output --env-file .env ${{ env.WINDOWS_2019_DOCKER_IMAGE_NAME }} sign ``-input_file_path="C:\CodeSignTool\examples\codesign.ps1" ``-output_dir_path=C:\CodeSignTool\output
docker run -i --rm --volume .\artifacts:C:\CodeSignTool\output --env-file .env ${{ env.WINDOWS_2019_DOCKER_IMAGE_NAME }} sign ``-input_file_path="C:\CodeSignTool\examples\codesign`` ``(1``).ps1" ``-output_dir_path=C:\CodeSignTool\output
- name: Upload Signed Files
uses: actions/upload-artifact@v3
Expand Down
1 change: 1 addition & 0 deletions Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,7 @@ COPY ./entrypoint.sh /entrypoint.sh
COPY ./examples /codesign/examples

RUN chmod +x /entrypoint.sh
RUN chmod +x /codesign/CodeSignTool.sh
RUN mkdir -p /codesign/output

WORKDIR /codesign
Expand Down
5 changes: 5 additions & 0 deletions codesign-tool/CodeSignTool.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
if [[ -z "${CODE_SIGN_TOOL_PATH}" ]]; then
java -jar ./jar/code_sign_tool-1.3.0.jar "$@"
else
java -jar ${CODE_SIGN_TOOL_PATH}/jar/code_sign_tool-1.3.0.jar "$@"
fi
15 changes: 11 additions & 4 deletions entrypoint.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,16 @@ if ($ENVIRONMENT_NAME -ne "PROD") {
Write-Host "Running ESigner.com CodeSign Action on $CURRENT_ENV"
Write-Host ""

$COMMAND = "C:/CodeSignTool/CodeSignTool.bat"
$COMMAND = "C:/CodeSignTool/jdk-11.0.2/bin/java -jar C:/CodeSignTool/jar/code_sign_tool-1.3.0.jar"

# CMD Args
$COMMAND = "$COMMAND $($CMD -join ' ')"
$numOfArgs = $args.Length
for ($i=0; $i -lt $numOfArgs; $i++)
{
$PARAM = $($args[$i])
$PARAM = $PARAM.Replace(" ", "`` ").Replace('(', "``(").Replace(')', "``)")
$COMMAND = "$COMMAND $($PARAM -join ' ')"
}

# Authentication Info
if ($CMD -notcontains "--help") {
Expand All @@ -41,6 +47,7 @@ if ($CMD -notcontains "--help") {
}
}

Write-Output "Running Command: $COMMAND"
$RESULT = & Invoke-Expression $COMMAND | Out-String
if ($RESULT -match "Error" -OR $RESULT -match "Exception" -OR $RESULT -match "Missing required option" -OR $RESULT -match "Unmatched arguments from" -OR $RESULT -match "Unmatched argument" -OR $RESULT -match "Not a valid output directory") {
Write-Host "Something Went Wrong. Please try again."
Expand All @@ -49,8 +56,8 @@ if ($RESULT -match "Error" -OR $RESULT -match "Exception" -OR $RESULT -match "Mi
} else {
if ($CMD -contains "sign")
{
$LOG_USERNAME = $USERNAME.Replace('"', "")
$LOG_CREDENTIAL_ID = $CREDENTIAL_ID.Replace('"', "")
$LOG_USERNAME = $env:USERNAME.Replace('"', "")
$LOG_CREDENTIAL_ID = $env:CREDENTIAL_ID.Replace('"', "")
Write-Host "Code signed successfully by ${LOG_USERNAME} using ${LOG_CREDENTIAL_ID} credential id"
}
Write-Host "$RESULT"
Expand Down
1 change: 1 addition & 0 deletions examples/codesign (1).ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Write-Output -InputObject "Happy Signing From ESigner.com!"

0 comments on commit a670fec

Please sign in to comment.