diff --git a/.woodpecker.release/release.ts b/.woodpecker.release/release.ts index 2d6e2f3..b55ec91 100644 --- a/.woodpecker.release/release.ts +++ b/.woodpecker.release/release.ts @@ -13,10 +13,17 @@ const repoUrl = 'https://codeberg.org/api/v1/repos/threadpanic/cb-src-woodpecker -// Extract the command-line argument and assign to 'version' +// Extract the first command-line argument and assign to 'version' const version = process.argv[2]; if (!version) { - console.error('Please provide the version as a command-line argument.'); + console.error('Please provide the version as the first command-line argument.'); + process.exit(1); +} + +// Extract the second command-line argument and assign to 'ci_build_number' +const ci_build_number = process.argv[3]; +if (!ci_build_number) { + console.error('Please provide the ci_build_number as the second command-line argument.'); process.exit(1); } @@ -66,7 +73,15 @@ async function addReleaseArtifact(fileName: string, releaseId: number) { async function createNewRelease() { const releaseUrl = `${repoUrl}/releases`; const requestBody = { - body: `Release v${version} of the LibreWolf source tarball. Please see the README.md file for compilation instructions and dependency details.`, + body: `Release v${version} of the LibreWolf source tarball. + + Please see the README.md file for compilation instructions and dependency details. + + * [${tarball_artifact}](https://storage.ci.librewolf.net/artifacts/${ci_build_number}/librewolf-${version}.source.tar.gz) + * [${sha256sum_artifact}](https://storage.ci.librewolf.net/artifacts/${ci_build_number}/librewolf-${version}.source.tar.gz.sha256sum) + + Note that these artifacts don't have a long shelf life in this particular s3 server, but it demonstrates the use of exernal storage to store big artifacts. + `, draft: false, name: `Release ${version}`, prerelease: false, @@ -77,7 +92,7 @@ async function createNewRelease() { const response = await axios.post(releaseUrl, requestBody, { headers: headers }); if (response.status === 201) { - await addReleaseArtifact(tarball_artifact, response.data.id); + // await addReleaseArtifact(tarball_artifact, response.data.id); await addReleaseArtifact(sha256sum_artifact, response.data.id); } else { throw new Error(`Failed to create release. Unexpected response status: ${response.status}`); diff --git a/.woodpecker.yml b/.woodpecker.yml index 0842501..11b13dd 100644 --- a/.woodpecker.yml +++ b/.woodpecker.yml @@ -24,54 +24,40 @@ steps: - make all +# uploading to storage.ci.librewolf.net + upload: + image: woodpeckerci/plugin-s3 + when: + - branch: main + settings: + bucket: artifacts + source: "*.{tar.gz,sha256sum}" + target: /${CI_BUILD_NUMBER} + path_style: true + endpoint: https://storage.ci.librewolf.net -# my ts+axios api stuff -###### -# -# release: -# image: alpine -# when: -# - branch: main -# commands: -# - apk update -U -# - apk add nodejs npm -# -# - ( cd .woodpecker.release && npm install && npm run build ) -# - ( cd .woodpecker.release && npm run start $(cat ../version)-$(cat ../release) ) -# -# secrets: [ cb_api_key ] -# + secrets: [aws_access_key_id, aws_secret_access_key] + display-links: + image: alpine + when: + - branch: main + commands: + - echo "https://storage.ci.librewolf.net/artifacts/${CI_BUILD_NUMBER}/librewolf-$(cat version)-$(cat release).source.tar.gz" + - echo "https://storage.ci.librewolf.net/artifacts/${CI_BUILD_NUMBER}/librewolf-$(cat version)-$(cat release).source.tar.gz.sha256sum" +# my ts+axios api stuff to make the codeberg release - - -# uploading to stortage.ci.librewolf.net -#### -# -# upload: -# image: woodpeckerci/plugin-s3 -# when: -# - branch: main -# settings: -# bucket: artifacts -# source: "*.{tar.gz,sha256sum}" -# target: /${CI_BUILD_NUMBER} -# path_style: true -# endpoint: https://storage.ci.librewolf.net -# -# secrets: [aws_access_key_id, aws_secret_access_key] -# -# display-links: -# image: alpine -# when: -# - branch: main -# commands: -# - echo "https://storage.ci.librewolf.net/artifacts/${CI_BUILD_NUMBER}/librewolf-$(cat version)-$(cat release).source.tar.gz" -# - echo "https://storage.ci.librewolf.net/artifacts/${CI_BUILD_NUMBER}/librewolf-$(cat version)-$(cat release).source.tar.gz.sha256sum" -# -# -# - - + release: + image: alpine + when: + - branch: main + commands: + - apk update -U + - apk add nodejs npm + + - ( cd .woodpecker.release && npm install && npm run build ) + - ( cd .woodpecker.release && npm run start $(cat ../version)-$(cat ../release) ${CI_BUILD_NUMBER} ) + + secrets: [ cb_api_key ] diff --git a/release b/release index d00491f..0cfbf08 100644 --- a/release +++ b/release @@ -1 +1 @@ -1 +2