-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathaction.yml
More file actions
60 lines (55 loc) · 2.12 KB
/
action.yml
File metadata and controls
60 lines (55 loc) · 2.12 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Compile AHKV2 Script
description: GitHub Action to compile AutoHotKey V2 scripts using Ahk2Exe
author: CCCC-L, nekocodeX
inputs:
in:
description: The path and name of the script to compile
required: true
out:
description: The path\name of the output .exe to be created
required: false
base:
description: compile bit number 32|64
required: false
default: 64
runs:
using: composite
steps:
- name: Install AutoHotkey
shell: pwsh
run: |
$wd = (Get-Item .).FullName
# 下载AHK主程序
Invoke-WebRequest (Invoke-RestMethod https://api.github.com/repos/AutoHotkey/AutoHotkey/releases/latest).assets[0].browser_download_url -OutFile "$wd\autohotkey.zip";
# 下载AHK2Exe
$response = Invoke-RestMethod "https://api.github.com/repos/AutoHotkey/Ahk2Exe/releases/latest"
foreach ($asset in $response[0].assets) {
$url = $asset.browser_download_url
}
Invoke-WebRequest $url -OutFile "$wd\autohotkey2exe.zip";
# 解压
Expand-Archive -Path "$wd\autohotkey.zip" -DestinationPath "$wd\autoHotkey\" -Force;
Expand-Archive -Path "$wd\autohotkey2exe.zip" -DestinationPath "$wd\autoHotkey\Compiler" -Force;
Remove-Item -Path "$wd\autohotkey.zip" -Force
Remove-Item -Path "$wd\autohotkey2exe.zip" -Force
Write-Output ("$wd\autohotkey\;" + "$wd\autohotkey\Compiler") | Out-File -FilePath $env:GITHUB_PATH -Encoding utf8 -Append
Write-Output ("BaseFile=$wd\autohotkey\AutoHotkey${{inputs.base}}.exe") | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
- name: Run AHK2Exe
shell: pwsh
run: |
$command = 'ahk2exe.exe /silent verbose '
if('${{inputs.in}}' -ne ''){
$command += '/in "${{inputs.in}}" '
}
if('${{inputs.out}}' -ne ''){
$command += '/out "${{inputs.out}}" '
}
if('${{inputs.base}}' -ne ''){
$command += '/base "$Env:BaseFile" '
}
$command += "| Write-Output"
Invoke-Expression $command
echo $command
branding:
color: gray-dark
icon: anchor