Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/approve-bot-pr.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:

- name: Checkout
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Approve
if: steps.human-commits.outputs.human_commits == 'false' && steps.unverified-commits.outputs.unverified_commits == 'false'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:

steps:
- name: Checkout repository
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Initialize CodeQL
uses: github/codeql-action/init@v3
Expand Down
106 changes: 106 additions & 0 deletions .github/workflows/compile-dependency.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,106 @@
name: 'Compile Dependency on Target - Reusable Workflow'

description: |
Compiles Dependency on given target, os, and arch

on:
workflow_call:
inputs:
version:
description: 'dependency version'
required: true
type: string
target:
description: 'dependency OS target variant'
required: true
type: string
os:
description: 'platform OS (e.g., linux)'
required: true
type: string
arch:
description: 'platform architecture (e.g., amd64)'
required: true
type: string
shouldCompile:
description: 'whether to compile the dependency'
required: true
type: boolean
shouldTest:
description: 'whether to test the dependency after compilation'
required: true
type: boolean
uploadArtifactName:
description: 'name of the artifact to upload'
required: true
type: string

jobs:
compile:
# Speed up compilation by using runners that match os and arch when they are set, otherwise fall back to emulation.
runs-on: ${{ (inputs.os == 'linux' && inputs.arch == 'arm64') && 'ubuntu-24.04-arm' || 'ubuntu-24.04' }}

steps:
- name: Check out code
uses: actions/checkout@v5

- name: Enable experimental features for Docker daemon and CLI
run: |
echo '{"experimental": true}' | sudo tee /etc/docker/daemon.json
sudo systemctl restart docker
mkdir -p ~/.docker
echo '{"experimental": "enabled"}' | sudo tee ~/.docker/config.json

- name: Set up QEMU
uses: docker/setup-qemu-action@v3

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Setup before compilation
id: compile-setup
run: |
echo "outputdir=$(mktemp -d)" >> "$GITHUB_OUTPUT"

- name: docker build
id: docker-build
env:
SKIP_LOGIN: true
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
uses: actions-hub/docker/cli@master
with:
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"

- name: docker run
id: docker-run
uses: actions-hub/docker/cli@master
env:
SKIP_LOGIN: true
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
with:
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) || '' }}"

- name: Print contents of output dir
shell: bash
run: ls -lah ${{ steps.compile-setup.outputs.outputdir }}

- name: Test Dependency
working-directory: dependency
if: ${{ (inputs.shouldCompile == true || inputs.shouldCompile == 'true') && (inputs.shouldTest == true || inputs.shouldTest == 'true') }}
run: |
#!/usr/bin/env bash
set -euo pipefail
shopt -s inherit_errexit

make test \
version="${{ inputs.version }}" \
tarballPath="${{ steps.compile-setup.outputs.outputdir }}/*.tgz" \
os="${{ inputs.os }}" \
arch="${{ inputs.arch }}"

- name: Upload compiled artifact
uses: actions/upload-artifact@v4
if: ${{ inputs.shouldCompile == true || inputs.shouldCompile == 'true' }}
with:
name: '${{ inputs.uploadArtifactName }}'
path: '${{ steps.compile-setup.outputs.outputdir }}/*'
107 changes: 87 additions & 20 deletions .github/workflows/create-draft-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,9 +22,9 @@ jobs:
builders: ${{ steps.builders.outputs.builders }}
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run Unit Tests
Expand All @@ -47,9 +47,9 @@ jobs:
fail-fast: false # don't cancel all test jobs when one fails
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: go.mod
- name: Run Integration Tests
Expand All @@ -61,14 +61,20 @@ jobs:
name: Release
runs-on: ubuntu-24.04
needs: integration
services:
registry:
image: registry:3
ports:
- 5000:5000

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
fetch-tags: true

- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: go.mod

Expand Down Expand Up @@ -110,13 +116,86 @@ jobs:
echo "buildpack_type=buildpack" >> "$GITHUB_OUTPUT"
fi

- name: Get buildpack path
id: get_buildpack_path
run: |

if [ -f "build/buildpackage.cnb" ]; then
echo "path=build/buildpackage.cnb" >> "$GITHUB_OUTPUT"
else
echo "path=build/buildpackage-linux-amd64.cnb" >> "$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 }}
buildpackage_path: ${{ steps.get_buildpack_path.outputs.path }}

- name: Get Image Digest
id: image_digest
run: |
image_name="localhost:5000/npm-install:latest"

./scripts/publish.sh \
--buildpack-type ${{ steps.get_buildpack_type.outputs.buildpack_type }} \
--image-ref $image_name

echo "digest=$(sudo skopeo inspect "docker://${image_name}" --tls-verify=false | jq -r .Digest)" >> "$GITHUB_OUTPUT"

- name: Set Correct Image Digest on the Release notes
run: |
printf '${{ steps.create-release-notes.outputs.release_body }}' \
| sed -E \
"s/\*\*Digest:\*\* \`sha256:[a-f0-9]{64}\`/\*\*Digest:\*\* \`${{ steps.image_digest.outputs.digest }}\`/" \
> ./release_notes

printf '${{ steps.image_digest.outputs.digest }}' > ./index-digest.sha256

- name: Create release assets
id: create_release_assets
run: |
release_assets=$(jq -n --arg repo_name "${{ github.event.repository.name }}" --arg tag "${{ steps.tag.outputs.tag }}" '
[
{
"path": "build/buildpack.tgz",
"name": ($repo_name + "-" + $tag + ".tgz"),
"content_type": "application/gzip"
},
{
"path": "./index-digest.sha256",
"name": ($repo_name + "-" + $tag + "-" + "index-digest.sha256"),
"content_type": "text/plain"
}
]')

for filepath in build/*.cnb; do
filename=$(basename "$filepath")
asset_name=""
if [[ "$filename" == "buildpackage-linux-amd64.cnb" ]]; then
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb"
elif [[ "$filename" == "buildpackage.cnb" ]]; then
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb"
else
formatted_filename="${filename#buildpackage-}"
asset_name="${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}-${formatted_filename}"
fi

release_assets=$(echo "$release_assets" | jq --arg asset_name "${asset_name}" --arg filepath "$filepath" '
. + [
{
"path": $filepath,
"name": $asset_name,
"content_type": "application/gzip"
}
]')
done

release_assets=$(jq -c <<< "$release_assets" )
printf "release_assets=%s\n" "${release_assets}" >> "$GITHUB_OUTPUT"

- name: Create Release
uses: paketo-buildpacks/github-config/actions/release/create@main
Expand All @@ -126,21 +205,9 @@ jobs:
tag_name: v${{ steps.tag.outputs.tag }}
target_commitish: ${{ github.sha }}
name: v${{ steps.tag.outputs.tag }}
body: ${{ steps.create-release-notes.outputs.release_body }}
body_filepath: "./release_notes"
draft: true
assets: |
[
{
"path": "build/buildpack.tgz",
"name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz",
"content_type": "application/gzip"
},
{
"path": "build/buildpackage.cnb",
"name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb",
"content_type": "application/gzip"
}
]
assets: ${{ steps.create_release_assets.outputs.release_assets }}

failure:
name: Alert on Failure
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint-yaml.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,10 +10,10 @@ jobs:
lintYaml:
runs-on: ubuntu-24.04
steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v5

- name: Checkout github-config
uses: actions/checkout@v4
uses: actions/checkout@v5
with:
repository: paketo-buildpacks/github-config
path: github-config
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,10 +14,10 @@ jobs:
runs-on: ubuntu-24.04
steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v5

- name: Setup Go
uses: actions/setup-go@v5
uses: actions/setup-go@v6
with:
go-version-file: go.mod

Expand Down
Loading
Loading