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.
This commit is contained in:
Dan Anglin 2023-09-22 12:42:10 +01:00
parent 8172a6b64d
commit 7937ecd50b
Signed by: dananglin
GPG key ID: 0C1D44CFBEE68638
3 changed files with 22 additions and 78 deletions

2
config

@ -1 +1 @@
Subproject commit 1b34822602a081787bc9c9e6e1e63fb7aabbffd9
Subproject commit bb91044ab7ca30cc56fa7f1e3a2a0434aa1bab91

View file

@ -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
}

View file

@ -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"
}
}
}