@@ -17,16 +17,16 @@ concurrency: release
1717jobs :
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@v5
2426 - name : Setup Go
25- uses : actions/setup-go@v3
27+ uses : actions/setup-go@v6
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,39 +39,45 @@ 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@v5
4951 - name : Setup Go
50- uses : actions/setup-go@v3
52+ uses : actions/setup-go@v6
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- steps :
65- - name : Setup Go
66- uses : actions/setup-go@v3
67- with :
68- go-version : ' stable '
64+ services :
65+ registry :
66+ image : registry:3
67+ ports :
68+ - 5000:5000
6969
70+ steps :
7071 - name : Checkout
71- uses : actions/checkout@v3
72+ uses : actions/checkout@v5
7273 with :
7374 fetch-tags : true
7475
76+ - name : Setup Go
77+ uses : actions/setup-go@v6
78+ with :
79+ go-version-file : go.mod
80+
7581 - name : Reset Draft Release
7682 id : reset
7783 uses : paketo-buildpacks/github-config/actions/release/reset-draft@main
@@ -110,13 +116,86 @@ jobs:
110116 echo "buildpack_type=buildpack" >> "$GITHUB_OUTPUT"
111117 fi
112118
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+
113129 - name : Create Release Notes
114130 id : create-release-notes
115131 uses : paketo-buildpacks/github-config/actions/release/notes@main
116132 with :
117133 repo : ${{ github.repository }}
118134 token : ${{ secrets.PAKETO_BOT_GITHUB_TOKEN }}
119135 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"
120199
121200 - name : Create Release
122201 uses : paketo-buildpacks/github-config/actions/release/create@main
@@ -126,25 +205,13 @@ jobs:
126205 tag_name : v${{ steps.tag.outputs.tag }}
127206 target_commitish : ${{ github.sha }}
128207 name : v${{ steps.tag.outputs.tag }}
129- body : ${{ steps.create-release-notes.outputs.release_body }}
208+ body_filepath : " ./release_notes "
130209 draft : true
131- assets : |
132- [
133- {
134- "path": "build/buildpack.tgz",
135- "name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.tgz",
136- "content_type": "application/gzip"
137- },
138- {
139- "path": "build/buildpackage.cnb",
140- "name": "${{ github.event.repository.name }}-${{ steps.tag.outputs.tag }}.cnb",
141- "content_type": "application/gzip"
142- }
143- ]
210+ assets : ${{ steps.create_release_assets.outputs.release_assets }}
144211
145212 failure :
146213 name : Alert on Failure
147- runs-on : ubuntu-22 .04
214+ runs-on : ubuntu-24 .04
148215 needs : [ unit, integration, release ]
149216 if : ${{ always() && needs.unit.result == 'failure' || needs.integration.result == 'failure' || needs.release.result == 'failure' }}
150217 steps :
0 commit comments