Skip to content

Commit 5a4015f

Browse files
paketo-botjericop
authored andcommitted
Updating github-config
1 parent dcd5727 commit 5a4015f

20 files changed

Lines changed: 676 additions & 171 deletions

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

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ jobs:
1010
download:
1111
name: Download PR Artifact
1212
if: ${{ github.event.workflow_run.event == 'pull_request' && github.event.workflow_run.conclusion == 'success' }}
13-
runs-on: ubuntu-22.04
13+
runs-on: ubuntu-24.04
1414
outputs:
1515
pr-author: ${{ steps.pr-data.outputs.author }}
1616
pr-number: ${{ steps.pr-data.outputs.number }}
@@ -32,7 +32,7 @@ jobs:
3232
name: Approve Bot PRs
3333
needs: download
3434
if: ${{ needs.download.outputs.pr-author == 'paketo-bot' || needs.download.outputs.pr-author == 'dependabot[bot]' }}
35-
runs-on: ubuntu-22.04
35+
runs-on: ubuntu-24.04
3636
steps:
3737
- name: Check Commit Verification
3838
id: unverified-commits
@@ -52,7 +52,7 @@ jobs:
5252

5353
- name: Checkout
5454
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
55-
uses: actions/checkout@v3
55+
uses: actions/checkout@v4
5656

5757
- name: Approve
5858
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'

.github/workflows/codeql-analysis.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,12 @@ on:
66
pull_request:
77
branches: [ main ]
88
schedule:
9-
- cron: '34 5 * * *' # daily at 5:34am UTC
9+
- cron: '34 5 * * *' # daily at 5:34am UTC
1010

1111
jobs:
1212
analyze:
1313
name: Analyze
14-
runs-on: ubuntu-22.04
14+
runs-on: ubuntu-24.04
1515

1616
strategy:
1717
fail-fast: false
@@ -21,15 +21,15 @@ jobs:
2121

2222
steps:
2323
- name: Checkout repository
24-
uses: actions/checkout@v3
24+
uses: actions/checkout@v4
2525

2626
- name: Initialize CodeQL
27-
uses: github/codeql-action/init@v2
27+
uses: github/codeql-action/init@v3
2828
with:
2929
languages: ${{ matrix.language }}
3030

3131
- name: Autobuild
32-
uses: github/codeql-action/autobuild@v2
32+
uses: github/codeql-action/autobuild@v3
3333

3434
- name: Perform CodeQL Analysis
35-
uses: github/codeql-action/analyze@v2
35+
uses: github/codeql-action/analyze@v3
Lines changed: 106 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,106 @@
1+
name: 'Compile Dependency on Target - Reusable Workflow'
2+
3+
description: |
4+
Compiles Dependency on given target, os, and arch
5+
6+
on:
7+
workflow_call:
8+
inputs:
9+
version:
10+
description: 'dependency version'
11+
required: true
12+
type: string
13+
target:
14+
description: 'dependency OS target variant'
15+
required: true
16+
type: string
17+
os:
18+
description: 'platform OS (e.g., linux)'
19+
required: true
20+
type: string
21+
arch:
22+
description: 'platform architecture (e.g., amd64)'
23+
required: true
24+
type: string
25+
shouldCompile:
26+
description: 'whether to compile the dependency'
27+
required: true
28+
type: boolean
29+
shouldTest:
30+
description: 'whether to test the dependency after compilation'
31+
required: true
32+
type: boolean
33+
uploadArtifactName:
34+
description: 'name of the artifact to upload'
35+
required: true
36+
type: string
37+
38+
jobs:
39+
compile:
40+
# Speed up compilation by using runners that match os and arch when they are set, otherwise fall back to emulation.
41+
runs-on: ${{ (inputs.os == 'linux' && inputs.arch == 'arm64') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}
42+
43+
steps:
44+
- name: Check out code
45+
uses: actions/checkout@v4
46+
47+
- name: Enable experimental features for Docker daemon and CLI
48+
run: |
49+
echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json
50+
sudo systemctl restart docker
51+
mkdir -p ~/.docker
52+
echo '{"experimental": "enabled"}' | sudo tee ~/.docker/config.json
53+
54+
- name: Set up QEMU
55+
uses: docker/setup-qemu-action@v3
56+
57+
- name: Set up Docker Buildx
58+
uses: docker/setup-buildx-action@v3
59+
60+
- name: Setup before compilation
61+
id: compile-setup
62+
run: |
63+
echo "outputdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"
64+
65+
- name: docker build
66+
id: docker-build
67+
env:
68+
SKIP_LOGIN: true
69+
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
70+
uses: actions-hub/docker/cli@master
71+
with:
72+
args: "build ${{ (inputs.os != '' && inputs.arch != '') && format('--platform {0}/{1}', inputs.os, inputs.arch) || '' }} -t compilation -f dependency/actions/compile/${{ inputs.target }}.Dockerfile dependency/actions/compile"
73+
74+
- name: docker run
75+
id: docker-run
76+
uses: actions-hub/docker/cli@master
77+
env:
78+
SKIP_LOGIN: true
79+
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
80+
with:
81+
args: "run ${{ (inputs.os != '' && inputs.arch != '') && format('--platform {0}/{1}', inputs.os, inputs.arch) || '' }} -v ${{ steps.compile-setup.outputs.outputdir }}:/home compilation --outputDir /home --target ${{ inputs.target }} --version ${{ inputs.version }} ${{ inputs.os != '' && format('--os {0}', inputs.os) || '' }} ${{ inputs.arch != '' && format('--arch {0}', inputs.arch) || '' }}"
82+
83+
- name: Print contents of output dir
84+
shell: bash
85+
run: ls -lah ${{ steps.compile-setup.outputs.outputdir }}
86+
87+
- name: Test Dependency
88+
working-directory: dependency
89+
if: ${{ (inputs.shouldCompile == true || inputs.shouldCompile == 'true') && (inputs.shouldTest == true || inputs.shouldTest == 'true') }}
90+
run: |
91+
#!/usr/bin/env bash
92+
set -euo pipefail
93+
shopt -s inherit_errexit
94+
95+
make test \
96+
version="${{ inputs.version }}" \
97+
tarballPath="${{ steps.compile-setup.outputs.outputdir }}/*.tgz" \
98+
os="${{ inputs.os }}" \
99+
arch="${{ inputs.arch }}"
100+
101+
- name: Upload compiled artifact
102+
uses: actions/upload-artifact@v4
103+
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
104+
with:
105+
name: '${{ inputs.uploadArtifactName }}'
106+
path: '${{ steps.compile-setup.outputs.outputdir }}/*'

.github/workflows/create-draft-release.yml

Lines changed: 116 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -17,16 +17,16 @@ concurrency: release
1717
jobs:
1818
unit:
1919
name: Unit Tests
20-
runs-on: ubuntu-22.04
20+
runs-on: ubuntu-24.04
2121
outputs:
2222
builders: ${{ steps.builders.outputs.builders }}
2323
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
2426
- name: Setup Go
25-
uses: actions/setup-go@v3
27+
uses: actions/setup-go@v5
2628
with:
27-
go-version: 'stable'
28-
- name: Checkout
29-
uses: actions/checkout@v3
29+
go-version-file: go.mod
3030
- name: Run Unit Tests
3131
run: ./scripts/unit.sh
3232
- name: Get builders from integration.json
@@ -39,43 +39,52 @@ jobs:
3939
4040
integration:
4141
name: Integration Tests
42-
runs-on: ubuntu-22.04
42+
runs-on: ubuntu-24.04
4343
needs: unit
4444
strategy:
4545
matrix:
4646
builder: ${{ fromJSON(needs.unit.outputs.builders) }}
4747
fail-fast: false # don't cancel all test jobs when one fails
4848
steps:
49+
- name: Checkout
50+
uses: actions/checkout@v4
4951
- name: Setup Go
50-
uses: actions/setup-go@v3
52+
uses: actions/setup-go@v5
5153
with:
52-
go-version: 'stable'
53-
- name: Checkout
54-
uses: actions/checkout@v3
54+
go-version-file: go.mod
5555
- name: Run Integration Tests
5656
run: ./scripts/integration.sh --builder ${{ matrix.builder }} --token ${{ github.token }}
5757
env:
5858
TMPDIR: "${{ runner.temp }}"
5959

6060
release:
6161
name: Release
62-
runs-on: ubuntu-22.04
62+
runs-on: ubuntu-24.04
6363
needs: integration
64+
services:
65+
registry:
66+
image: registry:2
67+
ports:
68+
- 5000:5000
69+
6470
steps:
65-
- name: Setup Go
66-
uses: actions/setup-go@v3
67-
with:
68-
go-version: 'stable'
6971
- name: Checkout
70-
uses: actions/checkout@v3
72+
uses: actions/checkout@v4
7173
with:
7274
fetch-tags: true
75+
76+
- name: Setup Go
77+
uses: actions/setup-go@v5
78+
with:
79+
go-version-file: go.mod
80+
7381
- name: Reset Draft Release
7482
id: reset
7583
uses: paketo-buildpacks/github-config/actions/release/reset-draft@main
7684
with:
7785
repo: ${{ github.repository }}
7886
token: ${{ github.token }}
87+
7988
- name: Calculate Semver Tag
8089
if: github.event.inputs.version == ''
8190
id: semver
@@ -84,6 +93,7 @@ jobs:
8493
repo: ${{ github.repository }}
8594
token: ${{ github.token }}
8695
ref-name: ${{ github.ref_name }}
96+
8797
- name: Set Release Tag
8898
id: tag
8999
run: |
@@ -92,14 +102,101 @@ jobs:
92102
tag="${{ steps.semver.outputs.tag }}"
93103
fi
94104
echo "tag=${tag}" >> "$GITHUB_OUTPUT"
105+
95106
- name: Package
96107
run: ./scripts/package.sh --version "${{ steps.tag.outputs.tag }}"
108+
109+
- name: Get buildpack type
110+
id: get_buildpack_type
111+
run: |
112+
113+
if [ -f "extension.toml" ]; then
114+
echo "buildpack_type=extension" >> "$GITHUB_OUTPUT"
115+
else
116+
echo "buildpack_type=buildpack" >> "$GITHUB_OUTPUT"
117+
fi
118+
119+
- name: Get buildpack path
120+
id: get_buildpack_path
121+
run: |
122+
123+
if [ -f "build/buildpackage.cnb" ]; then
124+
echo "path=build/buildpackage.cnb" >> "$GITHUB_OUTPUT"
125+
else
126+
echo "path=build/buildpackage-linux-amd64.cnb" >> "$GITHUB_OUTPUT"
127+
fi
128+
97129
- name: Create Release Notes
98130
id: create-release-notes
99131
uses: paketo-buildpacks/github-config/actions/release/notes@main
100132
with:
101133
repo: ${{ github.repository }}
102134
token: ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
135+
buildpack_type: ${{ steps.get_buildpack_type.outputs.buildpack_type }}
136+
buildpackage_path: ${{ steps.get_buildpack_path.outputs.path }}
137+
138+
- name: Get Image Digest
139+
id: image_digest
140+
run: |
141+
image_name="localhost:5000/npm-install:latest"
142+
143+
./scripts/publish.sh \
144+
--buildpack-type ${{ steps.get_buildpack_type.outputs.buildpack_type }} \
145+
--image-ref $image_name
146+
147+
echo "digest=$(sudo skopeo inspect "docker://${image_name}" --tls-verify=false | jq -r .Digest)" >> "$GITHUB_OUTPUT"
148+
149+
- name: Set Correct Image Digest on the Release notes
150+
run: |
151+
printf '${{ steps.create-release-notes.outputs.release_body }}' \
152+
| sed -E \
153+
"s/\*\*Digest:\*\* \`sha256:[a-f0-9]{64}\`/\*\*Digest:\*\* \`${{ steps.image_digest.outputs.digest }}\`/" \
154+
> ./release_notes
155+
156+
printf '${{ steps.image_digest.outputs.digest }}' > ./index-digest.sha256
157+
158+
- name: Create release assets
159+
id: create_release_assets
160+
run: |
161+
release_assets=$(jq -n --arg repo_name "${{ github.event.repository.name }}" --arg tag "${{ steps.tag.outputs.tag }}" '
162+
[
163+
{
164+
"path": "build/buildpack.tgz",
165+
"name": ($repo_name + "-" + $tag + ".tgz"),
166+
"content_type": "application/gzip"
167+
},
168+
{
169+
"path": "./index-digest.sha256",
170+
"name": ($repo_name + "-" + $tag + "-" + "index-digest.sha256"),
171+
"content_type": "text/plain"
172+
}
173+
]')
174+
175+
for filepath in build/*.cnb; do
176+
filename=$(basename "$filepath")
177+
asset_name=""
178+
if [[ "$filename" == "buildpackage-linux-amd64.cnb" ]]; then
179+
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb"
180+
elif [[ "$filename" == "buildpackage.cnb" ]]; then
181+
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb"
182+
else
183+
formatted_filename="${filename#buildpackage-}"
184+
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}-${formatted_filename}"
185+
fi
186+
187+
release_assets=$(echo "$release_assets" | jq --arg asset_name "${asset_name}" --arg filepath "$filepath" '
188+
. + [
189+
{
190+
"path": $filepath,
191+
"name": $asset_name,
192+
"content_type": "application/gzip"
193+
}
194+
]')
195+
done
196+
197+
release_assets=$(jq -c <<< "$release_assets" )
198+
printf "release_assets=%s\n" "${release_assets}" >> "$GITHUB_OUTPUT"
199+
103200
- name: Create Release
104201
uses: paketo-buildpacks/github-config/actions/release/create@main
105202
with:
@@ -108,25 +205,13 @@ jobs:
108205
tag_name: v${{ steps.tag.outputs.tag }}
109206
target_commitish: ${{ github.sha }}
110207
name: v${{ steps.tag.outputs.tag }}
111-
body: ${{ steps.create-release-notes.outputs.release_body }}
208+
body_filepath: "./release_notes"
112209
draft: true
113-
assets: |
114-
[
115-
{
116-
"path": "build/buildpack.tgz",
117-
"name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz",
118-
"content_type": "application/gzip"
119-
},
120-
{
121-
"path": "build/buildpackage.cnb",
122-
"name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb",
123-
"content_type": "application/gzip"
124-
}
125-
]
210+
assets: ${{ steps.create_release_assets.outputs.release_assets }}
126211

127212
failure:
128213
name: Alert on Failure
129-
runs-on: ubuntu-22.04
214+
runs-on: ubuntu-24.04
130215
needs: [ unit, integration, release ]
131216
if: ${{ always() && needs.unit.result == 'failure' || needs.integration.result == 'failure' || needs.release.result == 'failure' }}
132217
steps:

0 commit comments

Comments
 (0)