Skip to content

Commit 5896707

Browse files
committed
Updating github-config
1 parent 0964aea commit 5896707

15 files changed

Lines changed: 451 additions & 19 deletions

.github/CODEOWNERS

Lines changed: 0 additions & 1 deletion
This file was deleted.

.github/dependabot.yml

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
---
2+
version: 2
3+
updates:
4+
- package-ecosystem: gomod
5+
directory: "/"
6+
schedule:
7+
interval: daily

.github/labels.yml

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@
3535
description: An issue filed automatically when a release workflow run fails
3636
color: f00a0a
3737
- name: "failure:push"
38-
description: An issue filed automatically when a push stack images workflow run fails
38+
description: An issue filed automatically when a push buildpackage workflow run fails
39+
color: f00a0a
40+
- name: "failure:update-builder-toml"
41+
description: An issue filed automatically when a builder.toml update workflow run fails
3942
color: f00a0a
4043
- name: "failure:update-github-config"
4144
description: An issue filed automatically when a github config update workflow run fails

.github/release-drafter-config.yml

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# Config for https://github.com/release-drafter/release-drafter
2+
name-template: '$RESOLVED_VERSION'
3+
tag-template: 'v$RESOLVED_VERSION'
4+
filter-by-commitish: true
5+
commitish: main
6+
7+
change-template: '- $TITLE [#$NUMBER] by [@$AUTHOR](https://github.com/$AUTHOR)'
8+
template: |
9+
## Full Changelog
10+
11+
Following pull requests got merged for this release:
12+
13+
$CHANGES
14+
15+
version-resolver:
16+
major:
17+
labels:
18+
- 'semver:major'
19+
minor:
20+
labels:
21+
- 'semver:minor'
22+
patch:
23+
labels:
24+
- 'semver:patch'
25+
default: patch

.github/workflows/approve-bot-pr.yml

Lines changed: 19 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,3 +67,22 @@ jobs:
6767
gh pr merge ${{ needs.download.outputs.pr-number }} --auto --rebase
6868
env:
6969
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
70+
71+
failure:
72+
name: Alert on Failure
73+
runs-on: ubuntu-22.04
74+
needs: [download, approve]
75+
if: ${{ always() && needs.download.result == 'failure' || needs.approve.result == 'failure' }}
76+
steps:
77+
- name: File Failure Alert Issue
78+
uses: paketo-buildpacks/github-config/actions/issue/file@main
79+
with:
80+
token: ${{ secrets.GITHUB_TOKEN }}
81+
repo: ${{ github.repository }}
82+
label: "failure:approve-bot-pr"
83+
comment_if_exists: true
84+
issue_title: "Failure: Approve bot PR workflow"
85+
issue_body: |
86+
Approve bot PR workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}).
87+
comment_body: |
88+
Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}
Lines changed: 117 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,117 @@
1+
name: Create Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: release
9+
10+
jobs:
11+
smoke:
12+
name: Smoke Test
13+
runs-on: ubuntu-22.04
14+
outputs:
15+
release_notes: ${{ steps.notes.outputs.body }}
16+
steps:
17+
- name: Setup Go
18+
uses: actions/setup-go@v3
19+
with:
20+
go-version: 1.20.x
21+
22+
- name: Checkout
23+
uses: actions/checkout@v3
24+
25+
- name: Get pack version
26+
id: pack-version
27+
run: |
28+
version=$(jq -r .pack "scripts/.util/tools.json")
29+
echo "version=${version#v}" >> "$GITHUB_OUTPUT"
30+
31+
- name: Install Global Pack
32+
uses: buildpacks/github-actions/setup-pack@main
33+
with:
34+
pack-version: ${{ steps.pack-version.outputs.version }}
35+
36+
- name: Run Smoke Tests
37+
run: ./scripts/smoke.sh --name builder
38+
39+
- name: Generate Release Notes
40+
id: notes
41+
run: |
42+
notes="$(pack inspect-builder builder | grep -v 'Inspecting builder' \
43+
| grep -v 'REMOTE:' \
44+
| grep -v 'LOCAL:' \
45+
| grep -v '\(not present\)' \
46+
| grep -v 'Warning' \
47+
| sed -e '/./,$!d' \
48+
| awk -F, '{printf "%s\\n", $0}')"
49+
echo "body=${notes}" >> "$GITHUB_OUTPUT"
50+
51+
release:
52+
name: Release
53+
runs-on: ubuntu-22.04
54+
needs: smoke
55+
steps:
56+
- name: Checkout With History
57+
uses: actions/checkout@v3
58+
with:
59+
fetch-depth: 0 # gets full history
60+
61+
- name: Compare With Previous Release
62+
id: compare_previous_release
63+
run: |
64+
if [ -z "$(git diff $(git describe --tags --abbrev=0) -- builder.toml)" ]
65+
then
66+
echo "builder_changes=false" >> "$GITHUB_OUTPUT"
67+
else
68+
echo "builder_changes=true" >> "$GITHUB_OUTPUT"
69+
fi
70+
71+
- name: Publish Release
72+
id: publish
73+
if: ${{ steps.compare_previous_release.outputs.builder_changes == 'true' }}
74+
uses: release-drafter/release-drafter@v5
75+
with:
76+
config-name: release-drafter-config.yml
77+
publish: true
78+
env:
79+
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
80+
81+
- name: Update Release Notes
82+
if: ${{ steps.compare_previous_release.outputs.builder_changes == 'true' }}
83+
run: |
84+
set -euo pipefail
85+
shopt -s inherit_errexit
86+
87+
payload="{\"body\" : \"\`\`\`\n${RELEASE_BODY}\n\`\`\`\"}"
88+
89+
curl --fail \
90+
-X PATCH \
91+
-H "Accept: application/vnd.github.v3+json" \
92+
-H "Authorization: token ${GITHUB_TOKEN}" \
93+
"https://api.github.com/repos/${GITHUB_REPOSITORY}/releases/${RELEASE_ID}" \
94+
-d "${payload}"
95+
env:
96+
RELEASE_ID: ${{ steps.publish.outputs.id }}
97+
RELEASE_BODY: ${{ needs.smoke.outputs.release_notes }}
98+
GITHUB_TOKEN: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
99+
100+
failure:
101+
name: Alert on Failure
102+
runs-on: ubuntu-22.04
103+
needs: [ smoke, release ]
104+
if: ${{ always() && needs.smoke.result == 'failure' || needs.release.result == 'failure' }}
105+
steps:
106+
- name: File Failure Alert Issue
107+
uses: paketo-buildpacks/github-config/actions/issue/file@main
108+
with:
109+
token: ${{ secrets.GITHUB_TOKEN }}
110+
repo: ${{ github.repository }}
111+
label: "failure:release"
112+
comment_if_exists: true
113+
issue_title: "Failure: Create Release workflow"
114+
issue_body: |
115+
Create Release workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}).
116+
comment_body: |
117+
Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

.github/workflows/lint-yaml.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Lint Workflows
2+
3+
on:
4+
pull_request:
5+
paths:
6+
- '.github/**.yml'
7+
- '.github/**.yaml'
8+
9+
jobs:
10+
lintYaml:
11+
runs-on: ubuntu-22.04
12+
steps:
13+
- uses: actions/checkout@v3
14+
15+
- name: Checkout github-config
16+
uses: actions/checkout@v3
17+
with:
18+
repository: paketo-buildpacks/github-config
19+
path: github-config
20+
21+
- name: Set up Python
22+
uses: actions/setup-python@v4
23+
with:
24+
python-version: 3.8
25+
26+
- name: Install yamllint
27+
run: pip install yamllint
28+
29+
- name: Lint YAML files
30+
run: yamllint ./.github -c github-config/.github/.yamllint

.github/workflows/push-image.yml

Lines changed: 71 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,71 @@
1+
name: Push Builder Image
2+
3+
on:
4+
release:
5+
types:
6+
- published
7+
8+
jobs:
9+
push:
10+
name: Push
11+
runs-on: ubuntu-22.04
12+
steps:
13+
14+
- name: Parse Event
15+
id: event
16+
run: |
17+
echo "tag=$(jq -r '.release.tag_name' "${GITHUB_EVENT_PATH}" | sed s/^v//)" >> "$GITHUB_OUTPUT"
18+
19+
- name: Checkout
20+
uses: actions/checkout@v3
21+
22+
- name: Get pack version
23+
id: pack-version
24+
run: |
25+
version=$(jq -r .pack "scripts/.util/tools.json")
26+
echo "version=${version#v}" >> "$GITHUB_OUTPUT"
27+
28+
- name: Install Global Pack
29+
uses: buildpacks/github-actions/setup-pack@main
30+
with:
31+
pack-version: ${{ steps.pack-version.outputs.version }}
32+
33+
- name: Create Builder Image
34+
run: |
35+
pack builder create builder --config builder.toml
36+
37+
- name: Push To Dockerhub
38+
env:
39+
PAKETO_BUILDPACKS_DOCKERHUB_USERNAME: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_USERNAME }}
40+
PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD: ${{ secrets.PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD }}
41+
DOCKERHUB_ORG: "paketobuildpacks"
42+
run: |
43+
# Strip off the Github org prefix from repo name
44+
# paketo-buildpacks/builder-with-some-name --> builder-with-some-name
45+
registry_repo=$(echo "${{ github.repository }}" | sed 's/^.*\///')
46+
47+
echo "${PAKETO_BUILDPACKS_DOCKERHUB_PASSWORD}" | docker login --username "${PAKETO_BUILDPACKS_DOCKERHUB_USERNAME}" --password-stdin
48+
docker tag builder "${DOCKERHUB_ORG}/${registry_repo}:latest"
49+
docker tag builder "${DOCKERHUB_ORG}/${registry_repo}:${{ steps.event.outputs.tag }}"
50+
51+
docker push "${DOCKERHUB_ORG}/${registry_repo}:latest"
52+
docker push "${DOCKERHUB_ORG}/${registry_repo}:${{ steps.event.outputs.tag }}"
53+
54+
failure:
55+
name: Alert on Failure
56+
runs-on: ubuntu-22.04
57+
needs: [push]
58+
if: ${{ always() && needs.push.result == 'failure' }}
59+
steps:
60+
- name: File Failure Alert Issue
61+
uses: paketo-buildpacks/github-config/actions/issue/file@main
62+
with:
63+
token: ${{ secrets.GITHUB_TOKEN }}
64+
repo: ${{ github.repository }}
65+
label: "failure:push"
66+
comment_if_exists: true
67+
issue_title: "Failure: Push Image workflow"
68+
issue_body: |
69+
Push Image workflow [failed](https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}).
70+
comment_body: |
71+
Another failure occurred: https://github.com/${{github.repository}}/actions/runs/${{github.run_id}}

.github/workflows/test-builder.yml

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
name: Test Builder
2+
3+
on:
4+
workflow_dispatch: {}
5+
6+
jobs:
7+
8+
smoke:
9+
name: Smoke Test
10+
runs-on: ubuntu-22.04
11+
steps:
12+
- name: Setup Go
13+
uses: actions/setup-go@v3
14+
with:
15+
go-version: 1.20.x
16+
17+
- name: Checkout
18+
uses: actions/checkout@v3
19+
20+
- name: Run Smoke Tests
21+
run: ./scripts/smoke.sh

.github/workflows/test-pull-request.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ jobs:
1414
- name: Setup Go
1515
uses: actions/setup-go@v3
1616
with:
17-
go-version: 1.19.x
17+
go-version: 1.20.x
1818

1919
- name: Checkout
2020
uses: actions/checkout@v3

0 commit comments

Comments
 (0)