Skip to content

Commit

Permalink
V0.1.0 (#10)
Browse files Browse the repository at this point in the history
* Updates github action

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Fixes github action

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Debugging github action

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Debugging github action

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Debugging goreleaser config

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Debugging github action

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Splits sos and verifier build and packaging

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Debugging goreleaser config

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Debugging goreleaser config

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Debugging goreleaser config

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

* Fixes github action

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>

---------

Signed-off-by: Saahil Bhavsar <saahil_bhavsar@outlook.com>
  • Loading branch information
SaahilNotSahil authored Mar 30, 2024
1 parent 9905f93 commit 75ea395
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 37 deletions.
7 changes: 6 additions & 1 deletion .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,9 @@ jobs:
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
args: release --clean
args: release --clean --skip=validate --config=sos.goreleaser.yml
- uses: goreleaser/goreleaser-action@v4
with:
distribution: goreleaser
version: ${{ env.GITHUB_REF_NAME }}
args: release --clean --skip=validate --config=verifier.goreleaser.yml
2 changes: 2 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -24,3 +24,5 @@ go.work
.env

build/

aur/
35 changes: 35 additions & 0 deletions install.ps1
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
# Ensure the script is run as Administrator
if (-NOT ([Security.Principal.WindowsPrincipal][Security.Principal.WindowsIdentity]::GetCurrent()).IsInRole([Security.Principal.WindowsBuiltInRole] "Administrator")) {
Write-Host "This script must be run as an Administrator. Restarting as administrator..."
Start-Process powershell.exe "-NoProfile -ExecutionPolicy Bypass -File $($MyInvocation.MyCommand.Path)" -Verb RunAs
exit
}

# Define directories
$binDir = "bin"
$configDir = "scripts"
$installDir = "C:\Program Files\SOS"
$configInstallDir = "C:\ProgramData\SOS"

# Create installation directories if they don't exist
if (-Not (Test-Path $installDir)) {
New-Item -Path $installDir -ItemType Directory
}

if (-Not (Test-Path $configInstallDir)) {
New-Item -Path $configInstallDir -ItemType Directory
}

# Copy binaries
Copy-Item -Path "$binDir\sos.exe" -Destination $installDir -Force
Copy-Item -Path "$configDir\configure-sos-server.sh" -Destination $configInstallDir -Force
Copy-Item -Path ".\README.md" -Destination $configInstallDir -Force
Copy-Item -Path ".\LICENSE" -Destination $configInstallDir -Force

# Add to PATH environment variable
$envPath = [Environment]::GetEnvironmentVariable("Path", [EnvironmentVariableTarget]::Machine)
if (-Not ($envPath -like "*$installDir*")) {
[Environment]::SetEnvironmentVariable("Path", $envPath + ";$installDir", [EnvironmentVariableTarget]::Machine)
}

Write-Host "Installation of SOS completed successfully!"
38 changes: 2 additions & 36 deletions .goreleaser.yml → sos.goreleaser.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,32 +25,6 @@ builds:
- goos: windows
goarch: arm64

- main: ./verifier
id: "verifier"
binary: ./bin/verifier
goos:
- linux
- windows
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
- >-
{{- if eq .Os "darwin" }}
{{- if eq .Arch "amd64"}}CC=o64-clang{{- end }}
{{- if eq .Arch "arm64"}}CC=aarch64-apple-darwin20.2-clang{{- end }}
{{- end }}
{{- if eq .Os "windows" }}
{{- if eq .Arch "amd64" }}CC=x86_64-w64-mingw32-gcc{{- end }}
{{- end }}
flags:
- -mod=vendor
ignore:
- goos: windows
goarch: arm64

checksum:
name_template: "checksums.txt"

Expand All @@ -72,20 +46,13 @@ nfpms:
dst: /usr/share/doc/sos/README.md
- src: ./scripts/configure-sos-server.sh
dst: /etc/sos/scripts/configure-sos-server.sh
- src: ./bin/sos
dst: /usr/bin/sos
- src: ./bin/verifier
dst: /etc/sos/bin/verifier

release:
prerelease: auto
github:
owner: devlup-labs
name: sos
name_template: "{{.ProjectName}}-v{{.Version}}"
extra_files:
- glob: scripts/configure-sos-server.sh
- glob: bin/verifier

aurs:
- name: sos-bin
Expand All @@ -102,7 +69,6 @@ aurs:
private_key: "{{ .Env.AUR_KEY }}"
git_url: "ssh://aur@aur.archlinux.org/sos-bin.git"
package: |-
install -Dm755 "./bin/verifier" "${pkgdir}/etc/sos/bin/verifier"
install -Dm755 "./bin/sos" "${pkgdir}/usr/bin/sos"
install -Dm755 "./scripts/configure-sos-server.sh" "${pkgdir}/etc/sos/scripts/configure-sos-server.sh"
install -Dm644 "./LICENSE" "${pkgdir}/usr/share/licenses/sos/LICENSE"
Expand All @@ -116,5 +82,5 @@ archives:
files:
- LICENSE
- README.md
- scripts/*
- bin/*
- scripts/configure-sos-server.sh
- install.ps1
35 changes: 35 additions & 0 deletions verifier.goreleaser.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
builds:
- main: ./verifier
id: "verifier"
binary: ./bin/verifier
goos:
- linux
- darwin
goarch:
- amd64
- arm64
env:
- CGO_ENABLED=0
- >-
{{- if eq .Os "darwin" }}
{{- if eq .Arch "amd64"}}CC=o64-clang{{- end }}
{{- if eq .Arch "arm64"}}CC=aarch64-apple-darwin20.2-clang{{- end }}
{{- end }}
{{- if eq .Os "windows" }}
{{- if eq .Arch "amd64" }}CC=x86_64-w64-mingw32-gcc{{- end }}
{{- end }}
flags:
- -mod=vendor

release:
prerelease: auto
github:
owner: devlup-labs
name: sos
name_template: "{{.ProjectName}}-v{{.Version}}"

archives:
- format: binary
builds_info:
mode: 0755
wrap_in_directory: false

0 comments on commit 75ea395

Please sign in to comment.