From 7937ecd50bbb6d0b6284b561859acf1088dd025e Mon Sep 17 00:00:00 2001 From: Dan Anglin Date: Fri, 22 Sep 2023 12:42:10 +0100 Subject: [PATCH] chore: upgrade Forgejo to v1.20.4-1 Upgrade Forgejo to v1.20.4-1 Also the URLs for the Forgejo files is now nicely formatted so the JSON file for the Forgejo downloads is no longer needed and has been removed. --- config | 2 +- magefiles/download.go | 59 +++++++++++++++--------------------------- magefiles/forgejo.json | 39 ---------------------------- 3 files changed, 22 insertions(+), 78 deletions(-) delete mode 100644 magefiles/forgejo.json diff --git a/config b/config index 1b34822..bb91044 160000 --- a/config +++ b/config @@ -1 +1 @@ -Subproject commit 1b34822602a081787bc9c9e6e1e63fb7aabbffd9 +Subproject commit bb91044ab7ca30cc56fa7f1e3a2a0434aa1bab91 diff --git a/magefiles/download.go b/magefiles/download.go index eb03673..36f0208 100644 --- a/magefiles/download.go +++ b/magefiles/download.go @@ -3,7 +3,6 @@ package main import ( - "encoding/json" "fmt" "io" "net/http" @@ -95,42 +94,54 @@ func downloadForgejo(environment, version string) error { forgejoBinaryFileFormat = "forgejo-%s-linux-amd64" forgejoDigestExtension = ".sha256" forgejoSignatureExtension = ".asc" - forgejoJson = "./magefiles/forgejo.json" ) destinationDir := filepath.Join(rootBuildDir, environment, "forgejo") + binaryUrl := fmt.Sprintf( + "https://codeberg.org/forgejo/forgejo/releases/download/v%s/forgejo-%s-linux-amd64", + version, + version, + ) + binaryPath := filepath.Join( destinationDir, fmt.Sprintf(forgejoBinaryFileFormat, version), ) + signatureUrl := fmt.Sprintf( + "https://codeberg.org/forgejo/forgejo/releases/download/v%s/forgejo-%s-linux-amd64.asc", + version, + version, + ) + signaturePath := binaryPath + forgejoSignatureExtension - checksumPath := binaryPath + forgejoDigestExtension + checksumUrl := fmt.Sprintf( + "https://codeberg.org/forgejo/forgejo/releases/download/v%s/forgejo-%s-linux-amd64.sha256", + version, + version, + ) - data, err := newForgejoInfo(forgejoJson) - if err != nil { - return err - } + checksumPath := binaryPath + forgejoDigestExtension pack := downloadPack{ destinationDir: destinationDir, packages: []pack{ { file: object{ - source: data.Downloads[version].Binary, + source: binaryUrl, destination: binaryPath, }, gpgSignature: object{ - source: data.Downloads[version].Signature, + source: signatureUrl, destination: signaturePath, }, }, }, validateGPGSignature: true, checksum: object{ - source: data.Downloads[version].Digest, + source: checksumUrl, destination: checksumPath, }, validateChecksum: true, @@ -309,31 +320,3 @@ func download(pack downloadPack) error { return nil } - -type forgejoInfo struct { - Downloads map[string]forgejoFiles `json:"downloads"` -} - -type forgejoFiles struct { - Binary string `json:"binary"` - Signature string `json:"signature"` - Digest string `json:"digest"` -} - -func newForgejoInfo(path string) (forgejoInfo, error) { - var info forgejoInfo - - f, err := os.Open(path) - if err != nil { - return info, err - } - defer f.Close() - - decoder := json.NewDecoder(f) - - if err = decoder.Decode(&info); err != nil { - return info, err - } - - return info, nil -} diff --git a/magefiles/forgejo.json b/magefiles/forgejo.json deleted file mode 100644 index 43e8edf..0000000 --- a/magefiles/forgejo.json +++ /dev/null @@ -1,39 +0,0 @@ -{ - "downloads": { - "1.20.3-0": { - "binary": "https://codeberg.org/forgejo/forgejo/releases/download/v1.20.3-0/forgejo-1.20.3-0-linux-amd64", - "signature": "https://codeberg.org/forgejo/forgejo/releases/download/v1.20.3-0/forgejo-1.20.3-0-linux-amd64.asc", - "digest": "https://codeberg.org/forgejo/forgejo/releases/download/v1.20.3-0/forgejo-1.20.3-0-linux-amd64.sha256" - }, - "1.20.2-0": { - "binary": "https://codeberg.org/attachments/48524ed4-efdc-4ac5-8b68-f7d5c77d7672", - "signature": "https://codeberg.org/attachments/1dd1f72d-23e1-4c80-ba59-39a22d0bf4a6", - "digest": "https://codeberg.org/attachments/fdc5455a-82b1-4368-9af4-c5d6577f0e69" - }, - "1.20.1-0": { - "binary": "https://codeberg.org/attachments/4311f857-8337-42bb-8867-a686837fa524", - "signature": "https://codeberg.org/attachments/8eeb50ae-9b93-40ae-b06a-03d69c1188e9", - "digest": "https://codeberg.org/attachments/c7aa6d7f-7d88-40d7-b77b-1c8c6dff2885" - }, - "1.19.4-0": { - "binary": "https://codeberg.org/attachments/8aac5e74-a26b-44c9-83b8-267f114af958", - "signature": "https://codeberg.org/attachments/8e14bee9-2a08-41ad-879a-454e4360ab26", - "digest": "https://codeberg.org/attachments/ba537f06-bdd3-499b-93c8-ec5978d22510" - }, - "1.19.3-0": { - "binary": "https://codeberg.org/attachments/25eea495-ba85-4061-bec0-cf9823b63cb2", - "signature": "https://codeberg.org/attachments/046a829f-b2b1-4d12-b31a-4eec64437356", - "digest": "https://codeberg.org/attachments/1ef2b8d1-c707-4d3c-8646-d6e7f44e3649" - }, - "1.19.2-0": { - "binary": "https://codeberg.org/attachments/ade147e2-9a2a-4783-9628-d175dd6fc73a", - "signature": "https://codeberg.org/attachments/bb0143cc-d76b-4ebf-b963-670b5dd1e70d", - "digest": "https://codeberg.org/attachments/9374c96b-4387-4153-b349-2f6450705807" - }, - "1.19.1-0": { - "binary": "https://codeberg.org/attachments/f83c11d7-a22b-4494-9f62-61660e81b559", - "signature": "https://codeberg.org/attachments/24d04e8b-6c67-4ca5-a7fa-fc63fc905d6b", - "digest": "https://codeberg.org/attachments/be383a36-2edd-49a6-aa1c-ea993ffac197" - } - } -}