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 #399

Open
wants to merge 13 commits into
base: main
Choose a base branch
from
18 changes: 18 additions & 0 deletions .github/workflows/create-draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,19 @@ jobs:
uses: actions/setup-go@v3
with:
go-version: 'stable'

- name: Checkout
uses: actions/checkout@v3
with:
fetch-tags: true

- name: Reset Draft Release
id: reset
uses: paketo-buildpacks/github-config/actions/release/reset-draft@main
with:
repo: ${{ github.repository }}
token: ${{ github.token }}

- name: Calculate Semver Tag
if: github.event.inputs.version == ''
id: semver
Expand All @@ -84,6 +87,7 @@ jobs:
repo: ${{ github.repository }}
token: ${{ github.token }}
ref-name: ${{ github.ref_name }}

- name: Set Release Tag
id: tag
run: |
Expand All @@ -92,14 +96,28 @@ jobs:
tag="${{ steps.semver.outputs.tag }}"
fi
echo "tag=${tag}" >> "$GITHUB_OUTPUT"

- name: Package
run: ./scripts/package.sh --version "${{ steps.tag.outputs.tag }}"

- name: Get buildpack type
id: get_buildpack_type
run: |

if [ -f "extension.toml" ]; then
echo "buildpack_type=extension" >> "$GITHUB_OUTPUT"
else
echo "buildpack_type=buildpack" >> "$GITHUB_OUTPUT"
fi

- name: Create Release Notes
id: create-release-notes
uses: paketo-buildpacks/github-config/actions/release/notes@main
with:
repo: ${{ github.repository }}
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
buildpack_type: ${{ steps.get_buildpack_type.outputs.buildpack_type }}

- name: Create Release
uses: paketo-buildpacks/github-config/actions/release/create@main
with:
Expand Down
28 changes: 27 additions & 1 deletion .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,7 +76,7 @@ jobs:
sudo skopeo copy "oci-archive:${GITHUB_WORKSPACE}/buildpackage.cnb" "docker://gcr.io/${{ github.repository }}:latest"

- name: Push to DockerHub
id: push
if: ${{ steps.parse_configs.outputs.push_to_dockerhub == 'true' }}
env:
DOCKERHUB_USERNAME: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }}
DOCKERHUB_PASSWORD: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }}
Expand Down
Loading