diff --git a/.github/pipeline-descriptor.yml b/.github/pipeline-descriptor.yml index d935aad..941abf8 100644 --- a/.github/pipeline-descriptor.yml +++ b/.github/pipeline-descriptor.yml @@ -2,6 +2,9 @@ github: username: ${{ secrets.JAVA_GITHUB_USERNAME }} token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} +helpers: + "bin/helper": "$GOMOD/cmd/helper" + codeowners: - path: "*" owner: "@paketo-buildpacks/app-monitoring-maintainers" @@ -20,5 +23,11 @@ docker_credentials: password: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }} dependencies: -- id: yourkit-java +- name: YourKit Java Agent + id: yourkit-java + uses: docker://ghcr.io/paketo-buildpacks/actions/yourkit-dependency:main +- name: YourKit Java Agent ARM64 + id: yourkit-java uses: docker://ghcr.io/paketo-buildpacks/actions/yourkit-dependency:main + with: + arch: arm64 diff --git a/.github/pipeline-version b/.github/pipeline-version index f5b8b23..5edffce 100644 --- a/.github/pipeline-version +++ b/.github/pipeline-version @@ -1 +1 @@ -1.36.6 +1.39.0 diff --git a/.github/workflows/pb-create-package.yml b/.github/workflows/pb-create-package.yml index 4e62428..7e16a92 100644 --- a/.github/workflows/pb-create-package.yml +++ b/.github/workflows/pb-create-package.yml @@ -25,7 +25,7 @@ jobs: username: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }} - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install create-package run: | #!/usr/bin/env bash @@ -33,13 +33,24 @@ jobs: set -euo pipefail go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/create-package@latest - - uses: buildpacks/github-actions/setup-tools@v5.5.3 + - uses: buildpacks/github-actions/setup-tools@v5.6.0 with: - crane-version: 0.19.0 + crane-version: 0.19.1 yj-version: 5.1.0 - - uses: buildpacks/github-actions/setup-pack@v5.5.3 - with: - pack-version: 0.33.2 + - name: Install pack + run: | + #!/usr/bin/env bash + # this is coming from a copy of https://github.com/buildpacks/pack/actions/runs/8118576298 stored on box + # TODO to revisit when the official one is out + set -euo pipefail + + echo "Installing pack experimental" + + mkdir -p "${HOME}"/bin + echo "${HOME}/bin" >> "${GITHUB_PATH}" + + curl -L "https://ent.box.com/shared/static/j4d1bfe9uk1sb0i7zjvci0md9xmy41u4" -o ${HOME}/bin/pack + chmod +x "${HOME}"/bin/pack - name: Enable pack Experimental if: ${{ false }} run: | @@ -106,21 +117,23 @@ jobs: if [[ "${INCLUDE_DEPENDENCIES}" == "true" ]]; then create-package \ - --source ${SOURCE_PATH:-.} \ + --source "${SOURCE_PATH:-.}" \ --cache-location "${HOME}"/carton-cache \ --destination "${HOME}"/buildpack \ --include-dependencies \ --version "${VERSION}" else create-package \ - --source ${SOURCE_PATH:-.} \ + --source "${SOURCE_PATH:-.}" \ --destination "${HOME}"/buildpack \ --version "${VERSION}" fi - PACKAGE_FILE=${SOURCE_PATH:-.}/package.toml - [[ -e ${PACKAGE_FILE} ]] && cp ${PACKAGE_FILE} "${HOME}"/package.toml - printf '[buildpack]\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}"/buildpack "${OS}" >> "${HOME}"/package.toml + PACKAGE_FILE="${SOURCE_PATH:-.}/package.toml" + if [ -f "${PACKAGE_FILE}" ]; then + cp "${PACKAGE_FILE}" "${HOME}/buildpack/package.toml" + printf '[buildpack]\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}/buildpack" "${OS}" >> "${HOME}/buildpack/package.toml" + fi env: INCLUDE_DEPENDENCIES: "false" OS: linux @@ -133,15 +146,23 @@ jobs: set -euo pipefail + COMPILED_BUILDPACK="${HOME}/buildpack" + + # create-package puts the buildpack here, we need to run from that directory + # for component buildpacks so that pack doesn't need a package.toml + cd "${COMPILED_BUILDPACK}" + CONFIG="" + if [ -f "${COMPILED_BUILDPACK}/package.toml" ]; then + CONFIG="--config ${COMPILED_BUILDPACK}/package.toml" + fi PACKAGE_LIST=($PACKAGES) # Extract first repo (Docker Hub) as the main to package & register PACKAGE=${PACKAGE_LIST[0]} if [[ "${PUBLISH:-x}" == "true" ]]; then - pack buildpack package \ - "${PACKAGE}:${VERSION}" \ - --config "${HOME}"/package.toml \ + pack -v buildpack package \ + "${PACKAGE}:${VERSION}" ${CONFIG} \ --publish if [[ -n ${VERSION_MINOR:-} && -n ${VERSION_MAJOR:-} ]]; then @@ -165,10 +186,9 @@ jobs: done else - pack buildpack package \ - "${PACKAGE}:${VERSION}" \ - --config "${HOME}"/package.toml \ - --format "${FORMAT}" + pack -v buildpack package \ + "${PACKAGE}:${VERSION}" ${CONFIG} \ + --format "${FORMAT}" $([ -n "$TTL_SH_PUBLISH" ] && [ "$TTL_SH_PUBLISH" = "true" ] && echo "--publish") fi env: PACKAGES: docker.io/paketobuildpacks/yourkit gcr.io/paketo-buildpacks/yourkit @@ -199,7 +219,7 @@ jobs: DIGEST: ${{ steps.package.outputs.digest }} GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} - if: ${{ true }} - uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:4.0.1 + uses: docker://ghcr.io/buildpacks/actions/registry/request-add-entry:5.6.0 with: address: docker.io/paketobuildpacks/yourkit@${{ steps.package.outputs.digest }} id: paketo-buildpacks/yourkit diff --git a/.github/workflows/pb-tests.yml b/.github/workflows/pb-tests.yml index 6adcf4e..3f2fddb 100644 --- a/.github/workflows/pb-tests.yml +++ b/.github/workflows/pb-tests.yml @@ -17,7 +17,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install create-package run: | #!/usr/bin/env bash @@ -25,9 +25,20 @@ jobs: set -euo pipefail go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/create-package@latest - - uses: buildpacks/github-actions/setup-pack@v5.5.3 - with: - pack-version: 0.33.2 + - name: Install pack + run: | + #!/usr/bin/env bash + # this is coming from a copy of https://github.com/buildpacks/pack/actions/runs/8118576298 stored on box + # TODO to revisit when the official one is out + set -euo pipefail + + echo "Installing pack experimental" + + mkdir -p "${HOME}"/bin + echo "${HOME}/bin" >> "${GITHUB_PATH}" + + curl -L "https://ent.box.com/shared/static/j4d1bfe9uk1sb0i7zjvci0md9xmy41u4" -o ${HOME}/bin/pack + chmod +x "${HOME}"/bin/pack - name: Enable pack Experimental if: ${{ false }} run: | @@ -93,21 +104,23 @@ jobs: if [[ "${INCLUDE_DEPENDENCIES}" == "true" ]]; then create-package \ - --source ${SOURCE_PATH:-.} \ + --source "${SOURCE_PATH:-.}" \ --cache-location "${HOME}"/carton-cache \ --destination "${HOME}"/buildpack \ --include-dependencies \ --version "${VERSION}" else create-package \ - --source ${SOURCE_PATH:-.} \ + --source "${SOURCE_PATH:-.}" \ --destination "${HOME}"/buildpack \ --version "${VERSION}" fi - PACKAGE_FILE=${SOURCE_PATH:-.}/package.toml - [[ -e ${PACKAGE_FILE} ]] && cp ${PACKAGE_FILE} "${HOME}"/package.toml - printf '[buildpack]\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}"/buildpack "${OS}" >> "${HOME}"/package.toml + PACKAGE_FILE="${SOURCE_PATH:-.}/package.toml" + if [ -f "${PACKAGE_FILE}" ]; then + cp "${PACKAGE_FILE}" "${HOME}/buildpack/package.toml" + printf '[buildpack]\nuri = "%s"\n\n[platform]\nos = "%s"\n' "${HOME}/buildpack" "${OS}" >> "${HOME}/buildpack/package.toml" + fi env: INCLUDE_DEPENDENCIES: "true" OS: linux @@ -118,15 +131,23 @@ jobs: set -euo pipefail + COMPILED_BUILDPACK="${HOME}/buildpack" + + # create-package puts the buildpack here, we need to run from that directory + # for component buildpacks so that pack doesn't need a package.toml + cd "${COMPILED_BUILDPACK}" + CONFIG="" + if [ -f "${COMPILED_BUILDPACK}/package.toml" ]; then + CONFIG="--config ${COMPILED_BUILDPACK}/package.toml" + fi PACKAGE_LIST=($PACKAGES) # Extract first repo (Docker Hub) as the main to package & register PACKAGE=${PACKAGE_LIST[0]} if [[ "${PUBLISH:-x}" == "true" ]]; then - pack buildpack package \ - "${PACKAGE}:${VERSION}" \ - --config "${HOME}"/package.toml \ + pack -v buildpack package \ + "${PACKAGE}:${VERSION}" ${CONFIG} \ --publish if [[ -n ${VERSION_MINOR:-} && -n ${VERSION_MAJOR:-} ]]; then @@ -150,14 +171,14 @@ jobs: done else - pack buildpack package \ - "${PACKAGE}:${VERSION}" \ - --config "${HOME}"/package.toml \ - --format "${FORMAT}" + pack -v buildpack package \ + "${PACKAGE}:${VERSION}" ${CONFIG} \ + --format "${FORMAT}" $([ -n "$TTL_SH_PUBLISH" ] && [ "$TTL_SH_PUBLISH" = "true" ] && echo "--publish") fi env: FORMAT: image PACKAGES: test + TTL_SH_PUBLISH: "false" VERSION: ${{ steps.version.outputs.version }} unit: name: Unit Test @@ -172,7 +193,7 @@ jobs: restore-keys: ${{ runner.os }}-go- - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install richgo run: | #!/usr/bin/env bash diff --git a/.github/workflows/pb-update-go.yml b/.github/workflows/pb-update-go.yml index 8a47b62..4e13f64 100644 --- a/.github/workflows/pb-update-go.yml +++ b/.github/workflows/pb-update-go.yml @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - uses: actions/checkout@v4 - name: Update Go Version & Modules id: update-go @@ -49,7 +49,7 @@ jobs: echo "commit-body=${COMMIT_BODY}" >> "$GITHUB_OUTPUT" echo "commit-semver=${COMMIT_SEMVER}" >> "$GITHUB_OUTPUT" env: - GO_VERSION: "1.20" + GO_VERSION: "1.22" - uses: peter-evans/create-pull-request@v6 with: author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> diff --git a/.github/workflows/pb-update-pipeline.yml b/.github/workflows/pb-update-pipeline.yml index a80569f..2c05223 100644 --- a/.github/workflows/pb-update-pipeline.yml +++ b/.github/workflows/pb-update-pipeline.yml @@ -16,7 +16,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install octo run: | #!/usr/bin/env bash @@ -55,6 +55,12 @@ jobs: ) git add .github/ + git add .gitignore + + if [ -f scripts/build.sh ]; then + git add scripts/build.sh + fi + git checkout -- . echo "old-version=${OLD_VERSION}" >> "$GITHUB_OUTPUT" diff --git a/.github/workflows/pb-update-your-kit-java-agent-arm-64.yml b/.github/workflows/pb-update-your-kit-java-agent-arm-64.yml new file mode 100644 index 0000000..e246890 --- /dev/null +++ b/.github/workflows/pb-update-your-kit-java-agent-arm-64.yml @@ -0,0 +1,102 @@ +name: Update YourKit Java Agent ARM64 +"on": + schedule: + - cron: 0 5 * * 1-5 + workflow_dispatch: {} +jobs: + update: + name: Update Buildpack Dependency + runs-on: + - ubuntu-latest + steps: + - uses: actions/setup-go@v5 + with: + go-version: "1.22" + - name: Install update-buildpack-dependency + run: | + #!/usr/bin/env bash + + set -euo pipefail + + go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-buildpack-dependency@latest + - uses: buildpacks/github-actions/setup-tools@v5.6.0 + with: + crane-version: 0.19.1 + yj-version: 5.1.0 + - uses: actions/checkout@v4 + - id: dependency + uses: docker://ghcr.io/paketo-buildpacks/actions/yourkit-dependency:main + with: + arch: arm64 + - name: Update Buildpack Dependency + id: buildpack + run: | + #!/usr/bin/env bash + + set -euo pipefail + + VERSION_DEPS=$(yj -tj < buildpack.toml | jq -r ".metadata.dependencies[] | select( .id == env.ID ) | select( .version | test( env.VERSION_PATTERN ) )") + ARCH=${ARCH:-amd64} + OLD_VERSION=$(echo "$VERSION_DEPS" | jq -r 'select( .purl | contains( env.ARCH ) ) | .version') + + if [ -z "$OLD_VERSION" ]; then + ARCH="" # empty means noarch + OLD_VERSION=$(echo "$VERSION_DEPS" | jq -r ".version") + fi + + update-buildpack-dependency \ + --buildpack-toml buildpack.toml \ + --id "${ID}" \ + --arch "${ARCH}" \ + --version-pattern "${VERSION_PATTERN}" \ + --version "${VERSION}" \ + --cpe-pattern "${CPE_PATTERN:-}" \ + --cpe "${CPE:-}" \ + --purl-pattern "${PURL_PATTERN:-}" \ + --purl "${PURL:-}" \ + --uri "${URI}" \ + --sha256 "${SHA256}" \ + --source "${SOURCE_URI}" \ + --source-sha256 "${SOURCE_SHA256}" + + git add buildpack.toml + git checkout -- . + + if [ "$(echo "$OLD_VERSION" | awk -F '.' '{print $1}')" != "$(echo "$VERSION" | awk -F '.' '{print $1}')" ]; then + LABEL="semver:major" + elif [ "$(echo "$OLD_VERSION" | awk -F '.' '{print $2}')" != "$(echo "$VERSION" | awk -F '.' '{print $2}')" ]; then + LABEL="semver:minor" + else + LABEL="semver:patch" + fi + + echo "old-version=${OLD_VERSION}" >> "$GITHUB_OUTPUT" + echo "new-version=${VERSION}" >> "$GITHUB_OUTPUT" + echo "version-label=${LABEL}" >> "$GITHUB_OUTPUT" + env: + ARCH: arm64 + CPE: ${{ steps.dependency.outputs.cpe }} + CPE_PATTERN: "" + ID: yourkit-java + PURL: ${{ steps.dependency.outputs.purl }} + PURL_PATTERN: "" + SHA256: ${{ steps.dependency.outputs.sha256 }} + SOURCE_SHA256: ${{ steps.dependency.outputs.source_sha256 }} + SOURCE_URI: ${{ steps.dependency.outputs.source }} + URI: ${{ steps.dependency.outputs.uri }} + VERSION: ${{ steps.dependency.outputs.version }} + VERSION_PATTERN: '[\d]+\.[\d]+\.[\d]+' + - uses: peter-evans/create-pull-request@v6 + with: + author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> + body: Bumps `YourKit Java Agent ARM64` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildpack.outputs.new-version }}`. + branch: update/buildpack/your-kit-java-agent-arm-64 + commit-message: |- + Bump YourKit Java Agent ARM64 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + + Bumps YourKit Java Agent ARM64 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }}. + delete-branch: true + labels: ${{ steps.buildpack.outputs.version-label }}, type:dependency-upgrade + signoff: true + title: Bump YourKit Java Agent ARM64 from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} diff --git a/.github/workflows/pb-update-yourkit-java.yml b/.github/workflows/pb-update-your-kit-java-agent.yml similarity index 82% rename from .github/workflows/pb-update-yourkit-java.yml rename to .github/workflows/pb-update-your-kit-java-agent.yml index 32946a0..69dc415 100644 --- a/.github/workflows/pb-update-yourkit-java.yml +++ b/.github/workflows/pb-update-your-kit-java-agent.yml @@ -1,4 +1,4 @@ -name: Update yourkit-java +name: Update YourKit Java Agent "on": schedule: - cron: 0 5 * * 1-5 @@ -11,7 +11,7 @@ jobs: steps: - uses: actions/setup-go@v5 with: - go-version: "1.20" + go-version: "1.22" - name: Install update-buildpack-dependency run: | #!/usr/bin/env bash @@ -19,9 +19,9 @@ jobs: set -euo pipefail go install -ldflags="-s -w" github.com/paketo-buildpacks/libpak/cmd/update-buildpack-dependency@latest - - uses: buildpacks/github-actions/setup-tools@v5.5.3 + - uses: buildpacks/github-actions/setup-tools@v5.6.0 with: - crane-version: 0.19.0 + crane-version: 0.19.1 yj-version: 5.1.0 - uses: actions/checkout@v4 - id: dependency @@ -87,14 +87,14 @@ jobs: - uses: peter-evans/create-pull-request@v6 with: author: ${{ secrets.JAVA_GITHUB_USERNAME }} <${{ secrets.JAVA_GITHUB_USERNAME }}@users.noreply.github.com> - body: Bumps `yourkit-java` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildpack.outputs.new-version }}`. - branch: update/buildpack/yourkit-java + body: Bumps `YourKit Java Agent` from `${{ steps.buildpack.outputs.old-version }}` to `${{ steps.buildpack.outputs.new-version }}`. + branch: update/buildpack/your-kit-java-agent commit-message: |- - Bump yourkit-java from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + Bump YourKit Java Agent from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} - Bumps yourkit-java from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }}. + Bumps YourKit Java Agent from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }}. delete-branch: true labels: ${{ steps.buildpack.outputs.version-label }}, type:dependency-upgrade signoff: true - title: Bump yourkit-java from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} + title: Bump YourKit Java Agent from ${{ steps.buildpack.outputs.old-version }} to ${{ steps.buildpack.outputs.new-version }} token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }} diff --git a/.gitignore b/.gitignore index b90fc75..2f65ee4 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,4 @@ -# Copyright 2018-2022 the original author or authors. +# Copyright 2018-2020 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -13,6 +13,8 @@ # limitations under the License. bin/ +linux/ dependencies/ package/ scratch/ + diff --git a/buildpack.toml b/buildpack.toml index 50cbff5..e234bba 100644 --- a/buildpack.toml +++ b/buildpack.toml @@ -1,4 +1,4 @@ -# Copyright 2018-2022 the original author or authors. +# Copyright 2018-2024 the original author or authors. # # Licensed under the Apache License, Version 2.0 (the "License"); # you may not use this file except in compliance with the License. @@ -28,7 +28,7 @@ api = "0.7" uri = "https://github.com/paketo-buildpacks/yourkit/blob/main/LICENSE" [metadata] - include-files = ["LICENSE", "NOTICE", "README.md", "yourkit.png", "bin/build", "bin/detect", "bin/helper", "bin/main", "buildpack.toml"] + include-files = ["LICENSE", "NOTICE", "README.md", "yourkit.png", "linux/amd64/bin/build", "linux/amd64/bin/detect", "linux/amd64/bin/main", "linux/amd64/bin/helper", "linux/arm64/bin/build", "linux/arm64/bin/detect", "linux/arm64/bin/main", "linux/arm64/bin/helper", "buildpack.toml"] pre-package = "scripts/build.sh" [[metadata.configurations]] @@ -53,18 +53,33 @@ api = "0.7" name = "YourKit Java Agent" purl = "pkg:generic/yourkit-java-profiler@2024.3.152?arch=amd64" sha256 = "20d42b7be93aef424441706688134cf3f587788c63379d4b31660c4f15bfc7bf" - stacks = ["io.buildpacks.stacks.bionic", "io.paketo.stacks.tiny", "*"] + stacks = ["*"] uri = "https://download.yourkit.com/yjp/2024.3/YourKit-JavaProfiler-2024.3-b152-x64.zip" version = "2024.3.152" [[metadata.dependencies.licenses]] uri = "https://www.yourkit.com/purchase/eula.pdf" -[[stacks]] - id = "io.buildpacks.stacks.bionic" + [[metadata.dependencies]] + cpes = ["cpe:2.3:a:yourkit:java_profiler:2024.3.152:*:*:*:*:*:*:*"] + id = "yourkit-java" + name = "YourKit Java Agent" + purl = "pkg:generic/yourkit-java-profiler@2024.3.152?arch=arm64" + sha256 = "80eed465c2d449fc78df5c70b3b9a64bb29ac4fb87574f022f7aeb9b272c9506" + stacks = ["*"] + uri = "https://download.yourkit.com/yjp/2024.3/YourKit-JavaProfiler-2024.3-b152-arm64.zip" + version = "2024.3.152" -[[stacks]] - id = "io.paketo.stacks.tiny" + [[metadata.dependencies.licenses]] + uri = "https://www.yourkit.com/purchase/eula.pdf" [[stacks]] id = "*" + +[[targets]] + arch = "amd64" + os = "linux" + +[[targets]] + arch = "arm64" + os = "linux" diff --git a/scripts/build.sh b/scripts/build.sh index 104112b..9b05e98 100755 --- a/scripts/build.sh +++ b/scripts/build.sh @@ -1,17 +1,23 @@ #!/usr/bin/env bash - set -euo pipefail -GOOS="linux" go build -ldflags='-s -w' -o bin/helper github.com/paketo-buildpacks/yourkit/v4/cmd/helper -GOOS="linux" go build -ldflags='-s -w' -o bin/main github.com/paketo-buildpacks/yourkit/v4/cmd/main +GOMOD=$(head -1 go.mod | awk '{print $2}') +GOOS="linux" GOARCH="amd64" go build -ldflags='-s -w' -o "linux/amd64/bin/helper" "$GOMOD/cmd/helper" +GOOS="linux" GOARCH="arm64" go build -ldflags='-s -w' -o "linux/arm64/bin/helper" "$GOMOD/cmd/helper" +GOOS="linux" GOARCH="amd64" go build -ldflags='-s -w' -o linux/amd64/bin/main "$GOMOD/cmd/main" +GOOS="linux" GOARCH="arm64" go build -ldflags='-s -w' -o linux/arm64/bin/main "$GOMOD/cmd/main" if [ "${STRIP:-false}" != "false" ]; then - strip bin/helper bin/main + strip linux/amd64/bin/helper linux/arm64/bin/helper + strip linux/amd64/bin/main linux/arm64/bin/main fi -if [ "${COMPRESS:-false}" != "false" ]; then - upx -q -9 bin/helper bin/main +if [ "${COMPRESS:-none}" != "none" ]; then + $COMPRESS linux/amd64/bin/helper linux/arm64/bin/helper + $COMPRESS linux/amd64/bin/main linux/arm64/bin/main fi -ln -fs main bin/build -ln -fs main bin/detect +ln -fs main linux/amd64/bin/build +ln -fs main linux/arm64/bin/build +ln -fs main linux/amd64/bin/detect +ln -fs main linux/arm64/bin/detect \ No newline at end of file