-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
b6ba2ff
commit d167b07
Showing
8 changed files
with
156 additions
and
48 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
# Mandatory inputs | ||
INPUT_GOOGLE_CREDENTIALS_JSON={} | ||
INPUT_ALLURE_RESULTS_PATH=/github/workspace/test-results | ||
|
||
# Optional inputs | ||
#INPUT_OUTPUT=output-directory | ||
INPUT_REPORT_NAME='Example Report' | ||
INPUT_STORAGE_BUCKET=example-bucket | ||
INPUT_RETRIES=3 | ||
INPUT_SHOW_HISTORY=true | ||
INPUT_SLACK_CHANNEL=C1234567890 | ||
INPUT_SLACK_TOKEN=xoxb-1234567890-0987654321 | ||
INPUT_PREFIX=example-prefix |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,4 @@ | ||
|
||
.idea | ||
allure-deployer-action.iml | ||
allure-deployer-action.iml | ||
.env |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
FROM node:20-alpine AS deps | ||
LABEL authors="cybersokari" | ||
RUN apk add --no-cache openjdk17-jre | ||
|
||
FROM deps AS prod | ||
|
||
RUN npm i -g [email protected] | ||
COPY entrypoint.sh /entrypoint.sh | ||
RUN chmod +x /entrypoint.sh | ||
|
||
ENTRYPOINT ["/entrypoint.sh"] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,28 @@ | ||
BSD 3-Clause License | ||
|
||
Copyright (c) 2024, Sokari Gillis-Harry | ||
|
||
Redistribution and use in source and binary forms, with or without | ||
modification, are permitted provided that the following conditions are met: | ||
|
||
1. Redistributions of source code must retain the above copyright notice, this | ||
list of conditions and the following disclaimer. | ||
|
||
2. Redistributions in binary form must reproduce the above copyright notice, | ||
this list of conditions and the following disclaimer in the documentation | ||
and/or other materials provided with the distribution. | ||
|
||
3. Neither the name of the copyright holder nor the names of its | ||
contributors may be used to endorse or promote products derived from | ||
this software without specific prior written permission. | ||
|
||
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" | ||
AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE | ||
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE | ||
FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL | ||
DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR | ||
SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER | ||
CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, | ||
OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE | ||
OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
version: "3.8" | ||
services: | ||
test-action: | ||
build: | ||
context: . | ||
dockerfile: Dockerfile | ||
env_file: .env | ||
volumes: | ||
- /Users/sokari/IdeaProjects/allure-deployer/assets/allure-results:/github/workspace/allure-results |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,50 @@ | ||
#!/bin/sh | ||
|
||
# Exit immediately if a command exits with a non-zero status | ||
set -e | ||
|
||
# Validate required inputs | ||
if [ -z "$INPUT_GOOGLE_CREDENTIALS_JSON" ]; then | ||
echo "error: google_credentials_json is not provided" >&2 | ||
exit 1 | ||
fi | ||
|
||
if [ -z "$INPUT_ALLURE_RESULTS_PATH" ]; then | ||
echo "Error: allure_results_path is not provided" >&2 | ||
exit 1 | ||
fi | ||
|
||
# Create directory for the JSON file | ||
DIR="/credentials" | ||
mkdir -p "$DIR" | ||
JSON_FILE="$DIR/key.json" | ||
# Write the $GOOGLE_CREDENTIALS_JSON content to the JSON file | ||
echo "$INPUT_GOOGLE_CREDENTIALS_JSON" > "$JSON_FILE" # No cleanup needed, in non mounted Docker path | ||
# Export as GOOGLE_APPLICATION_CREDENTIALS for Firebase CLI auto auth | ||
export GOOGLE_APPLICATION_CREDENTIALS="$JSON_FILE" | ||
|
||
# Construct the command with all optional variables | ||
if [ -n "$INPUT_OUTPUT" ]; then | ||
deploy_command="allure-deployer generate \"$INPUT_ALLURE_RESULTS_PATH\"" | ||
[ -n "$INPUT_REPORT_NAME" ] && deploy_command="$deploy_command $INPUT_REPORT_NAME" | ||
[ -n "$GOOGLE_APPLICATION_CREDENTIALS" ] && deploy_command="$deploy_command --gcp-json $GOOGLE_APPLICATION_CREDENTIALS" | ||
[ -n "$INPUT_STORAGE_BUCKET" ] && deploy_command="$deploy_command --bucket $INPUT_STORAGE_BUCKET" | ||
[ "$INPUT_RETRIES" ] && deploy_command="$deploy_command --retries $INPUT_RETRIES" | ||
[ "$INPUT_SHOW_HISTORY" = "true" ] && deploy_command="$deploy_command --show-history" | ||
[ -n "$INPUT_PREFIX" ] && deploy_command="$deploy_command --prefix $INPUT_PREFIX" | ||
deploy_command="$deploy_command --output /github/workspace/$INPUT_OUTPUT" | ||
else | ||
deploy_command="allure-deployer deploy \"$INPUT_ALLURE_RESULTS_PATH\"" | ||
[ -n "$INPUT_REPORT_NAME" ] && deploy_command="$deploy_command $INPUT_REPORT_NAME" | ||
[ -n "$GOOGLE_APPLICATION_CREDENTIALS" ] && deploy_command="$deploy_command --gcp-json $GOOGLE_APPLICATION_CREDENTIALS" | ||
[ -n "$INPUT_STORAGE_BUCKET" ] && deploy_command="$deploy_command --bucket $INPUT_STORAGE_BUCKET" | ||
[ "$INPUT_RETRIES" ] && deploy_command="$deploy_command --retries $INPUT_RETRIES" | ||
[ "$INPUT_SHOW_HISTORY" = "true" ] && deploy_command="$deploy_command --show-history" | ||
[ -n "$INPUT_SLACK_CHANNEL" ] && deploy_command="$deploy_command --slack-channel $INPUT_SLACK_CHANNEL" | ||
[ -n "$INPUT_SLACK_TOKEN" ] && deploy_command="$deploy_command --slack-token $INPUT_SLACK_TOKEN" | ||
[ -n "$INPUT_PREFIX" ] && deploy_command="$deploy_command --prefix $INPUT_PREFIX" | ||
fi | ||
|
||
# Execute the constructed command | ||
eval "$deploy_command" | ||
#tail -f /dev/null |