diff --git a/.github/workflows/_build-and-cache-by-platform.yml b/.github/workflows/_build-and-cache-by-platform.yml index ded1dd8..e48be32 100644 --- a/.github/workflows/_build-and-cache-by-platform.yml +++ b/.github/workflows/_build-and-cache-by-platform.yml @@ -58,7 +58,7 @@ jobs: run: | # Run the compile script for Ubuntu 22.04 # Variables are defined by the Docker container this is running in. - bash "./compile-${OS_DIST}-${OS_DIST_VER}.sh" + bash "./compile-${OS_DIST}-${OS_DIST_NAME}.sh" - name: Package the compiled software working-directory: packages/${{ inputs.package-name }} @@ -67,11 +67,11 @@ jobs: echo -n "${GPG_KEY_B64}" | base64 --decode > 3C7658F0.asc mkdir -p ./dist - nfpm package --config nfpm-${OS_DIST}-${OS_DIST_VER}.yaml --packager deb --target ./dist + nfpm package --config nfpm-${OS_DIST}-${OS_DIST_NAME}.yaml --packager deb --target ./dist - name: Cache the packages uses: actions/cache/save@0c45773b623bea8c8e75f6c82b208c3cf94ea4f9 # v4.0.2 id: cache-packages with: - key: "${{ inputs.package-name }}-${{ inputs.package-version }}-${OS_DIST}-${OS_DIST_VER}-${{ matrix.Arch }}" + key: "${{ inputs.package-name }}-${{ inputs.package-version }}-${OS_DIST}-${OS_DIST_NAME}-${{ matrix.Arch }}" path: packages/${{ inputs.package-name }}/dist diff --git a/buildboxes/ubuntu/Dockerfile.v20.04 b/buildboxes/ubuntu/Dockerfile.v20.04 index 3659aa7..6ea6847 100644 --- a/buildboxes/ubuntu/Dockerfile.v20.04 +++ b/buildboxes/ubuntu/Dockerfile.v20.04 @@ -17,6 +17,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM." # Identify ourselves ENV OS_DIST ubuntu ENV OS_DIST_VER 20.04 +ENV OS_DIST_NAME focal ENV OS_DIST_PKG deb # Environment variables diff --git a/buildboxes/ubuntu/Dockerfile.v22.04 b/buildboxes/ubuntu/Dockerfile.v22.04 index bb2eea9..6adca9d 100644 --- a/buildboxes/ubuntu/Dockerfile.v22.04 +++ b/buildboxes/ubuntu/Dockerfile.v22.04 @@ -17,6 +17,7 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM." # Identify ourselves ENV OS_DIST ubuntu ENV OS_DIST_VER 22.04 +ENV OS_DIST_NAME jammy ENV OS_DIST_PKG deb # Environment variables diff --git a/buildboxes/ubuntu/_dockerfile.gotmpl b/buildboxes/ubuntu/_dockerfile.gotmpl index e068ea8..741a298 100644 --- a/buildboxes/ubuntu/_dockerfile.gotmpl +++ b/buildboxes/ubuntu/_dockerfile.gotmpl @@ -1,5 +1,5 @@ # syntax=docker/dockerfile:1 -FROM --platform=$TARGETPLATFORM ubuntu:{{ .UbuntuVersion }} +FROM --platform=$TARGETPLATFORM ubuntu:{{ .UbuntuVersion.Version }} SHELL ["/bin/bash", "-euxo", "pipefail", "-c"] {{ .DoNotEdit }} @@ -11,7 +11,8 @@ RUN echo "I am running on $BUILDPLATFORM, building for $TARGETPLATFORM." # Identify ourselves ENV OS_DIST ubuntu -ENV OS_DIST_VER {{ .UbuntuVersion }} +ENV OS_DIST_VER {{ .UbuntuVersion.Version }} +ENV OS_DIST_NAME {{ .UbuntuVersion.Codename }} ENV OS_DIST_PKG deb # Environment variables @@ -89,7 +90,7 @@ ARG BUILD_DATE ARG VCS_REF # https://github.com/opencontainers/image-spec/blob/master/annotations.md -LABEL org.opencontainers.image.title="Package Builder: Ubuntu {{ .UbuntuVersion }}" +LABEL org.opencontainers.image.title="Package Builder: Ubuntu {{ .UbuntuVersion.Version }}" LABEL org.opencontainers.image.description="Container image to help facilitate building packages for Ubuntu." LABEL org.opencontainers.image.url="https://github.com/northwood-labs/package-building" LABEL org.opencontainers.image.documentation="https://github.com/northwood-labs/package-building/wiki" diff --git a/buildboxes/ubuntu/generate-from-templates.go b/buildboxes/ubuntu/generate-from-templates.go index 23fc454..839431a 100644 --- a/buildboxes/ubuntu/generate-from-templates.go +++ b/buildboxes/ubuntu/generate-from-templates.go @@ -25,10 +25,17 @@ DO NOT EDIT THIS FILE! `)) ) -// JsonConfig models the JSON config file. -type JsonConfig struct { - UbuntuVersions []string `json:"UbuntuVersions"` -} +type ( + // JsonConfig models the JSON config file. + JsonConfig struct { + UbuntuVersions []UbuntuIdent `json:"UbuntuVersions"` + } + + UbuntuIdent struct { + Codename string `json:"Codename"` + Version string `json:"Version"` + } +) func main() { // Read the templates into memory. @@ -53,7 +60,7 @@ func main() { ubuntuVersion := config.UbuntuVersions[i] // Create the Dockerfile for the specific Java version. - dockerfileFile, err := os.Create(fmt.Sprintf("Dockerfile.v%s", ubuntuVersion)) + dockerfileFile, err := os.Create(fmt.Sprintf("Dockerfile.v%s", ubuntuVersion.Version)) if err != nil { log.Fatal(err) } diff --git a/buildboxes/ubuntu/template-values.json b/buildboxes/ubuntu/template-values.json index 8e871be..dbbac9c 100644 --- a/buildboxes/ubuntu/template-values.json +++ b/buildboxes/ubuntu/template-values.json @@ -1,6 +1,12 @@ { "UbuntuVersions": [ - "20.04", - "22.04" + { + "Version": "20.04", + "Codename": "focal" + }, + { + "Version": "22.04", + "Codename": "jammy" + } ] }