Skip to content

Commit

Permalink
Fix path handling for multiple custom packages
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinRohn committed Nov 27, 2024
1 parent 2627c21 commit 6a34e20
Show file tree
Hide file tree
Showing 5 changed files with 29 additions and 109 deletions.
7 changes: 5 additions & 2 deletions .github/workflows/setup.yml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,9 @@ jobs:
#
# Install a custom add-on package from file
#
# Path to the file: example/HVAC_Building_Process_Automation_SL_3.0.0.0.package
# Path to the file:
# example/custom_packages/HVAC_Building_Process_Automation_SL_3.0.0.0.package
# example/custom_packages/HVAC_KNX_SL_1.2.2.2.package
- name: Setup CODESYS
id: setup_codesys
uses: ./
Expand All @@ -85,4 +87,5 @@ jobs:
fb6f3506-d165-4e75-a1b9-98895d542cc8,4.5.0.0
bd131967-3a89-4e22-a845-79b0be0a3ce1,4.1.0.0
add-ons-from-file-list: |
example/HVAC_Building_Process_Automation_SL_3.0.0.0.package
example/custom_packages/HVAC_KNX_SL_1.2.2.2.package
example/custom_packages/HVAC_Building_Process_Automation_SL_3.0.0.0.package
123 changes: 19 additions & 104 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -20,23 +20,21 @@ It can also be used to process test cases or other CI/CD jobs in your workflow.
with:
installer-version: 2.3.0
auto-update-installer: false
generation: 3.5.19.0
generation: 3.5.20.0
architecture: 64
patch: 6
hotfix: 0
build: 0
patch: 4
```
## Usage examples
- Install CODESYS Version `3.5.17.2`:
- Install CODESYS Version `3.5.20.4`:
```yml
- name: Setup CODESYS
uses: powerIO-GmbH/action-codesys-setup@v1
with:
generation: 3.5.17.0
generation: 3.5.20.0
architecture: 64
patch: 2
patch: 4
```

- Install CODESYS Version `3.5.20.0` with following packages.
Expand All @@ -58,108 +56,25 @@ It can also be used to process test cases or other CI/CD jobs in your workflow.
dd6c2da4-2ed2-4076-9bf7-52394db68819,1.4.0.0
fb6f3506-d165-4e75-a1b9-98895d542cc8,4.5.0.0
add-ons-from-file-list: |
example/HVAC_Building_Process_Automation_SL_3.0.0.0.package
example/custom_packages/HVAC_Building_Process_Automation_SL_3.0.0.0.package
```

## Inputs

The action supports the following inputs:
| Input | Description | Required | Default |
|-------|-------------|----------|----------|
| `installer-version` | The version of the installer to use to install the CODESYS installation. | false | `2.3.0` |
| `generation` | This is the base generation you want to install (e.g., `3.5.19.0`). Even if you want to install version `3.5.19.6`, you have to define the generation as `3.5.19.0`. The patch version is defined by the `patch` input. | false | `3.5.19.0` |
| `architecture` | The installation architecture of CODESYS. Allowed inputs: `32` and `64`. | false | `64` |
| `patch` | The patch of the CODESYS version to install. | false | `0` |
| `hotfix` | The hotfix of the CODESYS version to install. | false | `0` |
| `build` | The build of the CODESYS version to install. | false | `0` |
| `installation-directory` | Custom installation directory. If empty, the path is set based on architecture and installation version. Examples:<br>- 64-bit, generation 3.5.19.0, patch 6: `C:\Program Files\CODESYS 3.5.19.6`<br>- 32-bit, generation 3.5.17.0, patch 2: `C:\Program Files (x86)\CODESYS 3.5.17.2` | false | `''` |
| `auto-update-installer` | If set to `true`, the installer will be updated before the installation. | false | `true` |
| `install-add-ons` | If set to `true`, the installer will install the CODESYS AddOns. | false | `false` |
| `add-ons-list` | List of addons to install, given by ID and version. Example:<br>`dd6c2da4-2ed2-4076-9bf7-52394db68819,1.4.0.0`<br>For multiple addons, create a new line for each addon. | false | `''` |
| `add-ons-from-file-list` | List of addons to install, given by the path to the `<name>.package` file. | false | `''` |

- `installer-version`

The version of the installer to use to install the CODESYS installation.

**required:** *false*
**default:** *`2.3.0`*

- `generation`

This is the base generation you want to install. For example `3.5.19.0`.
Even if you want to install the version `3.5.19.6` you have to define the generation as `3.5.19.0`.
The patch version is defined by the `patch` input.

**required:** *false*
**default:** *`3.5.19.0`*

- `architecture`

The installation architecture of CODESYS. Allowed inputs: `32` and `64`.

**required:** *false*
**default:** *`64`*

- `patch`

The patch of the CODESYS version to install.

**required:** *false*
**default:** *`0`*

- `hotfix`

The hotfix of the CODESYS version to install.

**required:** *false*
**default:** *`0`*

- `build`

The build of the CODESYS version to install.

**required:** *false*
**default:** *`0`*

- `installation-directory`

This can be used to define a custom installation directory.
If this input is empty, the installation path is set based on the architecture and installation version.

For example - bit `64`, generation `3.5.19.0` and patch `6`:
`C:\Program Files\CODESYS 3.5.19.6`

For example - bit `32`, generation `3.5.17.0` and patch `2`:
`C:\Program Files (x86)\CODESYS 3.5.17.2`

**required:** *false*
**default:** *`''`*

- `auto-update-installer`

If set to `true`, the installer will be updated before the installation.

**required:** *false*
**default:** *`true`*

- `install-add-ons`

If set to `true`, the installer will install the CODESYS AddOns.

**required:** *false*
**default:** *`false`*

- `add-ons-list`

A list of addons to install.
Given by the id and the version of the addon.
For example - Install Git: `dd6c2da4-2ed2-4076-9bf7-52394db68819,1.4.0.0`

If you want to install multiple addons, create a new line for each addon.
For example - Install Git and Library dev package:
```
dd6c2da4-2ed2-4076-9bf7-52394db68819,1.4.0.0
fb6f3506-d165-4e75-a1b9-98895d542cc8,4.5.0.0
```

**required:** *false*
**default:** *`''`*

- `add-ons-from-file-list`

A list of addons to install.
Given by the path to the `<name>.package` file

**required:** *false*
**default:** *`''`*

## Outputs

Expand Down
8 changes: 5 additions & 3 deletions action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -324,7 +324,7 @@ runs:
"--id `"${id}`" " +
"--version `"${version}`""
$process = Start-Process -FilePath $exePath -ArgumentList $arguments -Wait -NoNewWindow -PassThru
$process = Start-Process -FilePath $exePath -ArgumentList $arguments -Verb runas -Wait -PassThru
if ($process.ExitCode -eq 1 -or $process.ExitCode -eq -1) {
exit 0
} elseif ($process.ExitCode -ne 0) {
Expand All @@ -345,7 +345,9 @@ runs:
$rawList = "${{ inputs.add-ons-from-file-list }}" -split "\r?\n"
foreach ($line in $rawList) {
if (-not [string]::IsNullOrWhiteSpace($line)) {
$packagesToInstall += $line.Trim()
# Properly handle paths with Join-Path
$packagePath = Join-Path $env:GITHUB_WORKSPACE $line.Trim()
$packagesToInstall += $packagePath
}
}
Expand All @@ -357,7 +359,7 @@ runs:
"--location `"${{ steps.add_ons_path.outputs.directory }}`" " +
"--sourcefile `"${packagePath}`""
$process = Start-Process -FilePath $exePath -ArgumentList $arguments -Wait -NoNewWindow -PassThru
$process = Start-Process -FilePath $exePath -ArgumentList $arguments -Verb runas -Wait -PassThru
if ($process.ExitCode -eq 1 -or $process.ExitCode -eq -1) {
exit 0
} elseif ($process.ExitCode -ne 0) {
Expand Down
Binary file not shown.

0 comments on commit 6a34e20

Please sign in to comment.