Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Updates github-config #333

Open
wants to merge 12 commits into
base: main
Choose a base branch
from
Open
27 changes: 27 additions & 0 deletions .github/workflows/push-buildpackage.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,18 @@ on:
release:
types:
- published
env:
REGISTRIES_FILENAME: "registries.json"

jobs:
push:
name: Push
runs-on: ubuntu-22.04
steps:

- name: Checkout
uses: actions/checkout@v4

- name: Parse Event
id: event
run: |
Expand All @@ -30,6 +35,26 @@ jobs:
output: "/github/workspace/buildpackage.cnb"
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}

- name: Parse Configs
id: parse_configs
run: |
registries_filename="${{ env.REGISTRIES_FILENAME }}"

push_to_dockerhub=true
push_to_gcr=true

if [[ -f $registries_filename ]]; then
if jq 'has("dockerhub")' $registries_filename > /dev/null; then
push_to_dockerhub=$(jq '.dockerhub' $registries_filename)
fi
if jq 'has("GCR")' $registries_filename > /dev/null; then
push_to_gcr=$(jq '.GCR' $registries_filename)
fi
fi

echo "push_to_dockerhub=${push_to_dockerhub}" >> "$GITHUB_OUTPUT"
echo "push_to_gcr=${push_to_gcr}" >> "$GITHUB_OUTPUT"

- name: Validate version
run: |
buidpackTomlVersion=$(sudo skopeo inspect "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" | jq -r '.Labels."io.buildpacks.buildpackage.metadata" | fromjson | .version')
Expand All @@ -40,6 +65,7 @@ jobs:
fi

- name: Push to GCR
if: ${{ steps.parse_configs.outputs.push_to_gcr == 'true' }}
env:
GCR_PUSH_BOT_JSON_KEY: ${{ secrets.GCR_PUSH_BOT_JSON_KEY }}
run: |
Expand All @@ -50,6 +76,7 @@ jobs:
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:latest"

- name: Push to DockerHub
if: ${{ steps.parse_configs.outputs.push_to_dockerhub == 'true' }}
id: push
env:
DOCKERHUB_USERNAME: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }}
Expand Down
4 changes: 3 additions & 1 deletion .github/workflows/test-pull-request.yml
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ jobs:
uses: actions/checkout@v3

- name: Run Unit Tests
env:
GO_TEST_PARAMS: -count=5
run: ./scripts/unit.sh

- name: Get builders from integration.json
Expand Down Expand Up @@ -80,7 +82,7 @@ jobs:
runs-on: ubuntu-22.04
steps:
- name: Upload Artifact
uses: actions/upload-artifact@v3
uses: actions/upload-artifact@v4
with:
name: event-payload
path: ${{ github.event_path }}
6 changes: 3 additions & 3 deletions .github/workflows/update-go-mod-version.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
id: current-go-version
uses: paketo-buildpacks/github-config/actions/update-go-mod-version@main
with:
toolchain-version: ${{ steps.setup-go.outputs.go-version }}
go-version: ${{ steps.setup-go.outputs.go-version }}
- name: Go mod tidy
run: |
#!/usr/bin/env bash
Expand All @@ -54,7 +54,7 @@ jobs:
id: commit
uses: paketo-buildpacks/github-config/actions/pull-request/create-commit@main
with:
message: "Updates go mod toolchain version to ${{ steps.setup-go.outputs.go-version }}"
message: "Updates go mod version to ${{ steps.setup-go.outputs.go-version }}"
pathspec: "."
keyid: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY_ID }}
key: ${{ secrets.PAKETO_BOT_GPG_SIGNING_KEY }}
Expand All @@ -70,7 +70,7 @@ jobs:
uses: paketo-buildpacks/github-config/actions/pull-request/open@main
with:
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
title: "Updates go mod toolchain version to ${{ steps.setup-go.outputs.go-version }}"
title: "Updates go mod version to ${{ steps.setup-go.outputs.go-version }}"
branch: automation/go-mod-update/update-main

failure:
Expand Down
6 changes: 3 additions & 3 deletions scripts/.util/tools.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"createpackage": "v1.70.0",
"jam": "v2.8.0",
"pack": "v0.34.2"
"createpackage": "v1.72.1",
"jam": "v2.10.1",
"pack": "v0.36.1"
}
4 changes: 3 additions & 1 deletion scripts/unit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@ set -o pipefail
readonly PROGDIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
readonly BUILDPACKDIR="$(cd "${PROGDIR}/.." && pwd)"

GO_TEST_PARAMS="${GO_TEST_PARAMS:-}"

# shellcheck source=SCRIPTDIR/.util/tools.sh
source "${PROGDIR}/.util/tools.sh"

Expand Down Expand Up @@ -50,7 +52,7 @@ function unit::run() {

testout=$(mktemp)
pushd "${BUILDPACKDIR}" > /dev/null
if go test ./... -v -run Unit | tee "${testout}"; then
if go test ./... -v ${GO_TEST_PARAMS} -run Unit | tee "${testout}"; then
util::tools::tests::checkfocus "${testout}"
util::print::success "** GO Test Succeeded **"
else
Expand Down
Loading