Skip to content

Commit

Permalink
ci: update workflow for cross-platform compatibility in GitHub Actions
Browse files Browse the repository at this point in the history
Signed-off-by: Marko Kungla <[email protected]>
  • Loading branch information
mkungla committed Jan 29, 2024
1 parent 50a5f19 commit 8993d7a
Showing 1 changed file with 18 additions and 17 deletions.
35 changes: 18 additions & 17 deletions .github/workflows/monorepo-main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -70,25 +70,26 @@ jobs:
fi
shell: bash

- name: Prepare flag name
id: prepare-flag
shell: bash
- name: Prepare flag name (Windows)
if: runner.os == 'Windows'
run: |
if [ "${{ runner.os }}" = "Windows" ]; then
# PowerShell commands for Windows runner
$module_name = "${{ matrix.module }}"
$clean_module_name = $module_name.TrimStart('./') # Remove leading ./
if ($clean_module_name -eq ".") { $clean_module_name = "happy" }
echo "clean_module_name=$clean_module_name" | Out-File -Append -FilePath $Env:GITHUB_OUTPUT
else
# Bash commands for Ubuntu and macOS runners
module_name="${{ matrix.module }}"
clean_module_name="${module_name#./}" # Remove leading ./
if [[ "$clean_module_name" == "." ]]; then
clean_module_name="happy"
fi
echo "clean_module_name=$clean_module_name" >> $GITHUB_OUTPUT
$module_name = "./internal/cmd/hap"
$clean_module_name = $module_name.TrimStart('./') # Remove leading ./
if ($clean_module_name -eq ".") { $clean_module_name = "happy" }
echo "clean_module_name=$clean_module_name" | Out-File -Append -FilePath $Env:GITHUB_OUTPUT
shell: pwsh

- name: Prepare flag name (Linux and macOS)
if: runner.os != 'Windows'
run: |
module_name="./internal/cmd/hap"
clean_module_name="${module_name#./}" # Remove leading ./
if [[ "$clean_module_name" == "." ]]; then
clean_module_name="happy"
fi
echo "clean_module_name=$clean_module_name" >> $GITHUB_OUTPUT
shell: bash


- name: Upload coverage
if: steps.check-coverage.outputs.coverage_data_exists == 'true'
Expand Down

0 comments on commit 8993d7a

Please sign in to comment.