mirror of
https://github.com/ddworken/hishtory.git
synced 2025-02-22 21:41:01 +01:00
Add support for linux arm64 for #48
This commit is contained in:
parent
857e423e10
commit
7c86b812bf
15
.github/slsa/.slsa-goreleaser-linux-arm64.yml
vendored
Normal file
15
.github/slsa/.slsa-goreleaser-linux-arm64.yml
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
version: 1
|
||||
|
||||
env:
|
||||
- CGO_ENABLED=0
|
||||
|
||||
flags:
|
||||
- -trimpath
|
||||
|
||||
goos: linux
|
||||
goarch: arm64
|
||||
|
||||
binary: hishtory-{{ .Os }}-{{ .Arch }}
|
||||
|
||||
ldflags:
|
||||
- '{{ .Env.VERSION_LDFLAGS }}'
|
12
.github/workflows/slsa-releaser.yml
vendored
12
.github/workflows/slsa-releaser.yml
vendored
@ -35,6 +35,18 @@ jobs:
|
||||
go-version: 1.18
|
||||
evaluated-envs: "VERSION_LDFLAGS:${{needs.args.outputs.ldflags}}"
|
||||
compile-builder: true # See github.com/slsa-framework/slsa-github-generator/issues/942
|
||||
build-linux-arm64:
|
||||
permissions:
|
||||
id-token: write
|
||||
contents: write
|
||||
actions: read
|
||||
needs: args
|
||||
uses: slsa-framework/slsa-github-generator/.github/workflows/builder_go_slsa3.yml@v1.2.1
|
||||
with:
|
||||
config-file: .github/slsa/.slsa-goreleaser-linux-arm64.yml
|
||||
go-version: 1.18
|
||||
evaluated-envs: "VERSION_LDFLAGS:${{needs.args.outputs.ldflags}}"
|
||||
compile-builder: true # See github.com/slsa-framework/slsa-github-generator/issues/942
|
||||
build-freebsd-amd64:
|
||||
permissions:
|
||||
id-token: write
|
||||
|
@ -627,7 +627,7 @@ func decrementVersionIfInvalid(initialVersion string) string {
|
||||
}
|
||||
|
||||
func assertValidUpdate(updateInfo shared.UpdateInfo) error {
|
||||
urls := []string{updateInfo.LinuxAmd64Url, updateInfo.LinuxAmd64AttestationUrl,
|
||||
urls := []string{updateInfo.LinuxAmd64Url, updateInfo.LinuxAmd64AttestationUrl, updateInfo.LinuxArm64Url, updateInfo.LinuxArm64AttestationUrl,
|
||||
updateInfo.DarwinAmd64Url, updateInfo.DarwinAmd64UnsignedUrl, updateInfo.DarwinAmd64AttestationUrl,
|
||||
updateInfo.DarwinArm64Url, updateInfo.DarwinArm64UnsignedUrl, updateInfo.DarwinArm64AttestationUrl}
|
||||
for _, url := range urls {
|
||||
@ -683,6 +683,8 @@ func buildUpdateInfo(version string) shared.UpdateInfo {
|
||||
return shared.UpdateInfo{
|
||||
LinuxAmd64Url: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-linux-amd64", version),
|
||||
LinuxAmd64AttestationUrl: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-linux-amd64.intoto.jsonl", version),
|
||||
LinuxArm64Url: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-linux-arm64", version),
|
||||
LinuxArm64AttestationUrl: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-linux-arm64.intoto.jsonl", version),
|
||||
DarwinAmd64Url: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-darwin-amd64", version),
|
||||
DarwinAmd64UnsignedUrl: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-darwin-amd64-unsigned", version),
|
||||
DarwinAmd64AttestationUrl: fmt.Sprintf("https://github.com/ddworken/hishtory/releases/download/%s/hishtory-darwin-amd64.intoto.jsonl", version),
|
||||
|
@ -14,8 +14,10 @@ with urllib.request.urlopen('https://api.hishtory.dev/api/v1/download') as respo
|
||||
resp_body = response.read()
|
||||
download_options = json.loads(resp_body)
|
||||
|
||||
if platform.system() == 'Linux':
|
||||
if platform.system() == 'Linux' and platform.machine() == "x86_64":
|
||||
download_url = download_options['linux_amd_64_url']
|
||||
if platform.system() == 'Linux' and platform.machine() == "arm64":
|
||||
download_url = download_options['linux_arm_64_url']
|
||||
elif platform.system() == 'Darwin' and platform.machine() == 'arm64':
|
||||
download_url = download_options['darwin_arm_64_url']
|
||||
elif platform.system() == 'Darwin' and platform.machine() == 'x86_64':
|
||||
|
@ -817,6 +817,9 @@ func downloadFiles(updateInfo shared.UpdateInfo) error {
|
||||
if runtime.GOOS == "linux" && runtime.GOARCH == "amd64" {
|
||||
clientUrl = updateInfo.LinuxAmd64Url
|
||||
clientProvenanceUrl = updateInfo.LinuxAmd64AttestationUrl
|
||||
} else if runtime.GOOS == "linux" && runtime.GOARCH == "arm64" {
|
||||
clientUrl = updateInfo.LinuxArm64Url
|
||||
clientProvenanceUrl = updateInfo.LinuxArm64AttestationUrl
|
||||
} else if runtime.GOOS == "darwin" && runtime.GOARCH == "amd64" {
|
||||
clientUrl = updateInfo.DarwinAmd64Url
|
||||
clientProvenanceUrl = updateInfo.DarwinAmd64AttestationUrl
|
||||
|
@ -44,6 +44,8 @@ type DumpRequest struct {
|
||||
type UpdateInfo struct {
|
||||
LinuxAmd64Url string `json:"linux_amd_64_url"`
|
||||
LinuxAmd64AttestationUrl string `json:"linux_amd_64_attestation_url"`
|
||||
LinuxArm64Url string `json:"linux_arm_64_url"`
|
||||
LinuxArm64AttestationUrl string `json:"linux_arm_64_attestation_url"`
|
||||
DarwinAmd64Url string `json:"darwin_amd_64_url"`
|
||||
DarwinAmd64UnsignedUrl string `json:"darwin_amd_64_unsigned_url"`
|
||||
DarwinAmd64AttestationUrl string `json:"darwin_amd_64_attestation_url"`
|
||||
|
Loading…
Reference in New Issue
Block a user