Skip to content

Commit

Permalink
updates Dockerfile to remove upx, adds source Maven action
Browse files Browse the repository at this point in the history
  • Loading branch information
pivotal-david-osullivan committed Sep 21, 2023
1 parent fc1848a commit 0b4f932
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 8 deletions.
6 changes: 1 addition & 5 deletions actions/Dockerfile
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
FROM golang:1.20.8-bullseye as build-stage

RUN apt-get update && apt-get install -y --no-install-recommends upx
FROM golang:1.20 as build-stage

WORKDIR /src
ENV GO111MODULE=on CGO_ENABLED=0
Expand All @@ -17,8 +15,6 @@ RUN go build \

RUN strip /bin/action

RUN upx -q -9 /bin/action

FROM scratch
COPY --from=build-stage /etc/ssl/certs/ca-certificates.crt /etc/ssl/certs/ca-certificates.crt
COPY --from=build-stage /bin/action /bin/action
Expand Down
27 changes: 24 additions & 3 deletions actions/maven-dependency/main.go
Original file line number Diff line number Diff line change
Expand Up @@ -68,18 +68,28 @@ func main() {
panic(fmt.Errorf("unable to decode payload\n%w", err))
}

sources := make(map[string]string)
versions := make(actions.Versions)
for _, v := range raw.Versioning.Versions {
if p := versionPattern.MatchString(v); p {
w := fmt.Sprintf("%s/%s/%s/%s", u, strings.ReplaceAll(g, ".", "/"), a, v)
w = fmt.Sprintf("%s/%s-%s", w, a, v)
src := w

if s, ok := inputs["classifier"]; ok {
w = fmt.Sprintf("%s-%s", w, s)
}
if sc, ok := inputs["source_classifier"]; ok {
src = fmt.Sprintf("%s-%s", src, sc)
} else {
src = fmt.Sprintf("%s-%s", src, "src")
}
if s, ok := inputs["packaging"]; ok {
w = fmt.Sprintf("%s.%s", w, s)
src = fmt.Sprintf("%s.%s", src, s)
} else {
w = fmt.Sprintf("%s.jar", w)
src = fmt.Sprintf("%s.jar", src)
}

n, err := actions.NormalizeVersion(v)
Expand All @@ -88,12 +98,23 @@ func main() {
}

versions[n] = w
sources[n] = src
}
}

if o, err := versions.GetLatest(inputs); err != nil {
latestVersion, err := versions.GetLatestVersion(inputs)
if err != nil {
panic(err)
}
latestSource := actions.Outputs{}
if sources != nil {
latestSource["source"] = sources[latestVersion.Original()]
}

o, err := actions.NewOutputs(versions[latestVersion.Original()], latestVersion, latestSource)
if err != nil {
panic(err)
} else {
}else {
o.Write()
}
}
Expand All @@ -104,4 +125,4 @@ type Metadata struct {

type Versioning struct {
Versions []string `xml:"versions>version"`
}
}

0 comments on commit 0b4f932

Please sign in to comment.