Skip to content

Commit 212a9b0

Browse files
authored
Merge pull request #6 from SaifAqqad/main
Drop scoop as a dependency + rewrite Ahk2Exe script
2 parents 624763b + 05d3af0 commit 212a9b0

File tree

3 files changed

+58
-25
lines changed

3 files changed

+58
-25
lines changed

LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2021 nekocodeX
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -66,3 +66,7 @@ jobs:
6666
env:
6767
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
6868
```
69+
70+
## ©️ License
71+
72+
MIT License

action.yaml

Lines changed: 33 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -14,39 +14,47 @@ inputs:
1414
description: The icon of the executable file is specified
1515
required: false
1616
default: ''
17+
base:
18+
description: The name of the base file to be used for Ahk2Exe
19+
required: false
20+
default: ''
1721

1822
runs:
1923
using: composite
2024
steps:
21-
- name: Install Scoop
22-
shell: powershell
23-
run: |
24-
iwr -useb get.scoop.sh | iex
25-
scoop bucket add extras
26-
27-
- name: Add to environment variables
28-
shell: powershell
29-
run: Write-Output ('Path=' + $Env:SystemDrive + '\Windows\System32' + ';' + $Env:UserProfile + '\scoop\shims') >> $Env:GITHUB_ENV
30-
3125
- name: Install AutoHotkey
32-
shell: powershell
33-
run: scoop install autohotkey
34-
35-
- name: Ahk2Exe
36-
shell: powershell
26+
shell: pwsh
3727
run: |
38-
if (('${{inputs.in}}' -ne '') -and ('${{inputs.out}}' -ne '') -and ('${{inputs.icon}}' -ne '')) {
39-
ahk2exe /in '${{inputs.in}}' /out '${{inputs.out}}' /icon '${{inputs.icon}}'
40-
} elseif (('${{inputs.in}}' -ne '') -and ('${{inputs.out}}' -ne '')) {
41-
ahk2exe /in '${{inputs.in}}' /out '${{inputs.out}}'
42-
} elseif (('${{inputs.in}}' -ne '') -and ('${{inputs.icon}}' -ne '')) {
43-
ahk2exe /in '${{inputs.in}}' /icon '${{inputs.icon}}'
44-
} elseif ('${{inputs.in}}' -ne '') {
45-
ahk2exe /in '${{inputs.in}}'
46-
} else {
47-
throw 'There are no required parameters'
28+
$cwd = (Get-Item .).FullName;
29+
Invoke-WebRequest "https://www.autohotkey.com/download/ahk.zip" -OutFile "$cwd\autohotkey.zip";
30+
Expand-Archive -Path "$cwd\autohotkey.zip" -DestinationPath "$cwd\_autohotkey\" -Force;
31+
Remove-Item -Path "$cwd\autohotkey.zip" -Force
32+
Write-Output ("$cwd\_autohotkey\;" + "$cwd\_autohotkey\Compiler") | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
33+
if('${{inputs.base}}' -ne ''){
34+
Write-Output ("BaseFile=$cwd\_autohotkey\Compiler\${{inputs.base}}.bin") | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
35+
}else{
36+
Copy-Item -Path "$cwd\_autohotkey\Compiler\Unicode 32-bit.bin" -Destination "$cwd\_autohotkey\Compiler\AutoHotkeySC.bin"
4837
}
4938
39+
- name: Run Ahk2Exe
40+
shell: pwsh
41+
run: |
42+
$command = 'ahk2exe.exe /silent verbose '
43+
if('${{inputs.in}}' -ne ''){
44+
$command += '/in "${{inputs.in}}" '
45+
}
46+
if('${{inputs.out}}' -ne ''){
47+
$command += '/out "${{inputs.out}}" '
48+
}
49+
if('${{inputs.icon}}' -ne ''){
50+
$command += '/icon "${{inputs.icon}}" '
51+
}
52+
if('${{inputs.base}}' -ne ''){
53+
$command += '/base "$Env:BaseFile" '
54+
}
55+
$command += "| Write-Output"
56+
Invoke-Expression $command
57+
5058
branding:
5159
color: green
5260
icon: terminal

0 commit comments

Comments
 (0)