-
Notifications
You must be signed in to change notification settings - Fork 470
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
#26386 Loading push command options from .env file.
- Loading branch information
Showing
2 changed files
with
50 additions
and
6 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 |
---|---|---|
|
@@ -25,6 +25,15 @@ jobs: | |
with: | ||
fetch-depth: 0 | ||
|
||
- name: Load .env file | ||
uses: aarcangeli/[email protected] | ||
with: | ||
if-file-not-found: 'warn' | ||
|
||
- name: Print env vars | ||
run: | | ||
echo "$GITHUB_ENV" | ||
- name: Get changes | ||
id: changed-files | ||
run: | | ||
|
@@ -76,13 +85,46 @@ jobs: | |
echo "Workspace has been updated." | ||
fi | ||
- name: Options command | ||
id: options | ||
run: | | ||
import os | ||
# Access environment variables | ||
PUSH_OPTIONS = {} | ||
PUSH_OPTIONS["dry-run"] = os.getenv("DOT_CLI_DRY_RUN") | ||
PUSH_OPTIONS["fail-fast"] = os.getenv("DOT_CLI_FAIL_FAST") | ||
PUSH_OPTIONS["forceSiteExecution"] = os.getenv("DOT_CLI_FORCE_SITE_EXECUTION") | ||
PUSH_OPTIONS["removeAssets"] = os.getenv("DOT_CLI_REMOVE_ASSETS") | ||
PUSH_OPTIONS["removeContentTypes"] = os.getenv("DOT_CLI_REMOVE_CONTENT_TYPES") | ||
PUSH_OPTIONS["retry-attempts"] = os.getenv("DOT_CLI_RETRY_ATTEMPS") | ||
PUSH_OPTIONS["removeFolders"] = os.getenv("DOT_CLI_REMOVE_FOLDERS") | ||
PUSH_OPTIONS["removeLanguages"] = os.getenv("DOT_CLI_REMOVE_LANGUAGES") | ||
PUSH_OPTIONS["removeSites"] = os.getenv("DOT_CLI_REMOVE_SITES") | ||
COMMAND_PUSH_OPTS = ""; | ||
for key, value in PUSH_OPTIONS.items(): | ||
if value != None: | ||
if value.lower() == "true": | ||
COMMAND_PUSH_OPTS=f"{COMMAND_PUSH_OPTS} --{key}" | ||
elif value.lower() != "false": | ||
COMMAND_PUSH_OPTS=f"{COMMAND_PUSH_OPTS} --{key}={value}" | ||
with open(os.environ['GITHUB_OUTPUT'], 'a') as f: | ||
print(f 'COMMAND_PUSH_OPTS={COMMAND_PUSH_OPTS}', file=f) | ||
print(COMMAND_PUSH_OPTS) | ||
shell: python | ||
|
||
- name: Run dotCMS CLI | ||
id: dot-push | ||
run: | | ||
chmod +x ./.github/workflows/scripts/run-push.sh | ||
source ./.github/workflows/scripts/run-push.sh | ||
install_cli "${{env.DOT_CLI_JAR_DOWNLOAD_URL}}" "${{env.DOT_FORCE_DOWNLOAD}}" "${{env.DOT_API_URL}}" | ||
run_cli_push "${{github.workspace}}${{env.DOT_REPO_BASE_PATH}}" "${{ secrets.DOT_TOKEN }}" | ||
install_cli "${{env.DOT_CLI_JAR_DOWNLOAD_URL}}" "${{env.DOT_FORCE_DOWNLOAD}}" "${{env.DOT_API_URL}}" | ||
run_cli_push "${{github.workspace}}${{env.DOT_REPO_BASE_PATH}}" "${{ steps.options.outputs.COMMAND_PUSH_OPTS }}" "${{ secrets.DOT_TOKEN }}" | ||
echo "exit-code=$exit_code" >> "$GITHUB_OUTPUT" | ||
print_log | ||
if [ $exit_code -ne 0 ]; then | ||
|
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