Skip to content

Commit 5493fa1

Browse files
committed
Rename ref to sha.
A REF is typically a human-readable path to a branch where as a SHA is a hash representing an individual commit. Since the latter is what's being used here, this aims to avoid confusion.
1 parent 9c5d296 commit 5493fa1

2 files changed

Lines changed: 11 additions & 11 deletions

File tree

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"url": "https://develop.svn.wordpress.org/trunk"
88
},
99
"gutenberg": {
10-
"ref": "e0c5fc81de25a4f837c063ca2c2db32d74698a49"
10+
"sha": "e0c5fc81de25a4f837c063ca2c2db32d74698a49"
1111
},
1212
"engines": {
1313
"node": ">=20.10.0",

tools/gutenberg/download-gutenberg.js

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
* This script downloads a pre-built Gutenberg zip artifact from the GitHub
77
* Container Registry and extracts it into the ./gutenberg directory.
88
*
9-
* The artifact is identified by the "gutenberg.ref" value in the root
9+
* The artifact is identified by the "gutenberg.sha" value in the root
1010
* package.json, which is used as the OCI image tag for the gutenberg-build
1111
* package on GHCR.
1212
*
@@ -72,25 +72,25 @@ function exec( command, args, options = {} ) {
7272
async function main() {
7373
console.log( '🔍 Checking Gutenberg configuration...' );
7474

75-
// Read Gutenberg ref from package.json.
76-
let ref;
75+
// Read Gutenberg SHA from package.json.
76+
let sha;
7777
try {
7878
const packageJson = JSON.parse(
7979
fs.readFileSync( packageJsonPath, 'utf8' )
8080
);
81-
ref = packageJson.gutenberg?.ref;
81+
sha = packageJson.gutenberg?.sha;
8282

83-
if ( ! ref ) {
84-
throw new Error( 'Missing "gutenberg.ref" in package.json' );
83+
if ( ! sha ) {
84+
throw new Error( 'Missing "gutenberg.sha" in package.json' );
8585
}
8686

87-
console.log( ` Reference: ${ ref }` );
87+
console.log( ` SHA: ${ sha }` );
8888
} catch ( error ) {
8989
console.error( '❌ Error reading package.json:', error.message );
9090
process.exit( 1 );
9191
}
9292

93-
const zipName = `gutenberg-${ ref }.zip`;
93+
const zipName = `gutenberg-${ sha }.zip`;
9494
const zipPath = path.join( rootDir, zipName );
9595

9696
// Step 1: Get an anonymous GHCR token for pulling.
@@ -113,15 +113,15 @@ async function main() {
113113
}
114114

115115
// Step 2: Get the manifest to find the blob digest.
116-
console.log( `\n📋 Fetching manifest for ${ ref }...` );
116+
console.log( `\n📋 Fetching manifest for ${ sha }...` );
117117
let digest;
118118
try {
119119
const manifestJson = await exec( 'curl', [
120120
'--silent',
121121
'--fail',
122122
'--header', `Authorization: Bearer ${ token }`,
123123
'--header', 'Accept: application/vnd.oci.image.manifest.v1+json',
124-
`https://ghcr.io/v2/${ GHCR_REPO }/manifests/${ ref }`,
124+
`https://ghcr.io/v2/${ GHCR_REPO }/manifests/${ sha }`,
125125
], { captureOutput: true } );
126126
const manifest = JSON.parse( manifestJson );
127127
digest = manifest?.layers?.[ 0 ]?.digest;

0 commit comments

Comments
 (0)