-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
6 changed files
with
145 additions
and
14 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 |
---|---|---|
|
@@ -9,29 +9,53 @@ on: | |
permissions: | ||
contents: write | ||
# packages: write | ||
# issues: write | ||
# issues: write | ||
|
||
jobs: | ||
goreleaser: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: pull repo | ||
uses: actions/checkout@v3 | ||
with: | ||
fetch-depth: 0 | ||
- run: git fetch --force --tags | ||
- uses: actions/setup-go@v4 | ||
|
||
- name: git fetch | ||
run: git fetch --force --tags | ||
|
||
- name: setup go | ||
uses: actions/setup-go@v4 | ||
with: | ||
go-version: stable | ||
# More assembly might be required: Docker logins, GPG, etc. It all depends | ||
# on your needs. | ||
- uses: goreleaser/goreleaser-action@v4 | ||
|
||
- name: set version in main.go | ||
run: sed -i "s/rest.StartServer(c.Port, \"1.0.0\")/rest.StartServer(c.Port, \"$(git tag | sort -Vr | head -n 1)\")/g" $PWD/main.go | ||
|
||
- name: build go | ||
uses: goreleaser/goreleaser-action@v4 | ||
with: | ||
# either 'goreleaser' (default) or 'goreleaser-pro': | ||
distribution: goreleaser | ||
version: latest | ||
args: release --clean | ||
args: release --clean --skip-publish --skip-validate | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# Your GoReleaser Pro key, if you are using the 'goreleaser-pro' | ||
# distribution: | ||
# GORELEASER_KEY: ${{ secrets.GORELEASER_KEY }} | ||
|
||
- name: innosetup | ||
run: | | ||
cp ./dist/hyper-v-rest-ps_windows_amd64_v1/hyper-v-rest-ps.exe packaging/hyper-v-rest-ps.exe | ||
cd packaging/ | ||
docker build . --security-opt label=disable -t inno:64bit | ||
bash ./iscc.sh 64 innosetup.iss | ||
mv hyper-v-rest-ps.exe hyper-v-rest-ps-portable.exe | ||
- name: upload release | ||
id: create_release | ||
uses: marvinpinto/[email protected] | ||
with: | ||
repo_token: ${{ secrets.GITHUB_TOKEN }} | ||
title: Release ${{ github.ref }} | ||
draft: false | ||
prerelease: false | ||
files: | | ||
./packaging/hyper-v-rest-ps-portable.exe | ||
./packaging/Output/hyper-v-rest-ps-setup.exe |
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 |
---|---|---|
@@ -1,4 +1,5 @@ | ||
.idea/ | ||
config.yml | ||
*.gob | ||
conf/config.yml | ||
packaging/Output | ||
packaging/*.exe | ||
*.exe |
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 |
---|---|---|
@@ -0,0 +1,8 @@ | ||
FROM docker.io/amake/innosetup:64bit | ||
USER root | ||
ENV HOME /home/xclient | ||
ENV WINEPREFIX /home/xclient/.wine | ||
#ENV WINEARCH win32 | ||
RUN chown -R root /home | ||
WORKDIR /work | ||
ENTRYPOINT ["iscc"] |
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 |
---|---|---|
@@ -0,0 +1,16 @@ | ||
@ECHO OFF | ||
setlocal enabledelayedexpansion | ||
set "ServiceNames[0]=wmi-rest" | ||
set "ServiceNames[1]=hyper-v-rest-wmi" | ||
set "ServiceNames[2]=hyper-v-rest-ps" | ||
|
||
for /l %%i in (0, 1, 2) do ( | ||
set "ServiceName=!ServiceNames[%%i]!" | ||
sc query !ServiceName! | find "STATE" | find "RUNNING" >nul | ||
if !errorLevel! equ 0 ( | ||
sc stop !ServiceName! | ||
) | ||
sc delete !ServiceName! | ||
) | ||
|
||
endlocal |
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 |
---|---|---|
@@ -0,0 +1,55 @@ | ||
[Setup] | ||
AppName=HyperV REST PS | ||
AppVersion=2.1 | ||
AppPublisher=Mono Bilisim | ||
AppPublisherURL=https://mono.net.tr | ||
AppSupportURL=https://github.com/monobilisim/hyper-v-rest-ps | ||
AppUpdatesURL=https://github.com/monobilisim/hyper-v-rest-ps | ||
DefaultDirName={code:GetProgramFiles}\hyper-v-rest-ps | ||
UsePreviousAppDir=false | ||
UninstallDisplayIcon={app}\hyper-v-rest-ps.exe | ||
OutputBaseFilename=hyper-v-rest-ps-setup | ||
Compression=lzma | ||
SolidCompression=yes | ||
|
||
[Code] | ||
function GetProgramFiles(Param: string): string; | ||
begin | ||
if IsWin64 then Result := ExpandConstant('{commonpf64}') | ||
else Result := ExpandConstant('{commonpf32}') | ||
end; | ||
procedure TaskKill(FileName: String); | ||
var | ||
ResultCode: Integer; | ||
begin | ||
Exec('taskkill.exe', '/f /im ' + '"' + FileName + '"', '', SW_HIDE, | ||
ewWaitUntilTerminated, ResultCode); | ||
end; | ||
[Files] | ||
Source: "hyper-v-rest-ps.exe"; DestDir: "{app}"; BeforeInstall: TaskKill('hyper-v-rest-ps.exe') | ||
Source: "cleanup.bat"; DestDir: "{app}" | ||
|
||
|
||
[Icons] | ||
;Name: "{group}\HyperV REST PS"; Filename: "{app}\hyper-v-rest-ps.exe" | ||
;Name: "{group}\Uninstall"; Filename: "{uninstallexe}" | ||
|
||
|
||
[Messages] | ||
SetupAppTitle=HyperV REST PS | ||
|
||
|
||
[Run] | ||
Filename: "{app}\cleanup.bat" | ||
Filename: "{app}\hyper-v-rest-ps.exe"; Description: "Install Service"; Parameters: --service=install | ||
Filename: "{app}\hyper-v-rest-ps.exe"; Description: "Start Service" ; Parameters: --service=start | ||
|
||
|
||
[UninstallRun] | ||
Filename: "{app}\cleanup.bat" | ||
Filename: "{app}\hyper-v-rest-ps.exe"; Parameters: --service=stop | ||
Filename: "{app}\hyper-v-rest-ps.exe"; Parameters: --service=uninstall | ||
Filename: "{cmd}"; Parameters: "/C ""taskkill /im hyper-v-rest-ps.exe /f /t" |
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 |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/usr/bin/env bash | ||
|
||
relpaths() { | ||
for arg in "$@"; do printf -- "%s\n" "${arg#$PWD/}"; done | ||
} | ||
|
||
bindpaths() { | ||
for arg in $(relpaths "$@"); do | ||
if [ -e "$arg" ] && [[ "$arg" == /* ]]; then | ||
printf -- "-v %s:%s" "$arg" "$arg" | ||
fi | ||
done | ||
} | ||
|
||
case $1 in | ||
32) | ||
exec docker run --rm -i --security-opt label=disable -v "$PWD":/work $(bindpaths "$@") -e WINEDEBUG=-all inno:32bit $(relpaths "${@:2}") | ||
;; | ||
64) | ||
exec docker run --rm -i --security-opt label=disable -v "$PWD":/work $(bindpaths "$@") -e WINEDEBUG=-all inno:64bit $(relpaths "${@:2}") | ||
;; | ||
*) | ||
exit 1 | ||
;; | ||
esac | ||
|
||
chown -R $USER: $PWD/ |