@@ -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@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
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