Skip to content

Commit 2dbe4c6

Browse files
committed
fixup! build,deps,tools: prepare to update to OpenSSL 4.1
1 parent 60c7f9c commit 2dbe4c6

2 files changed

Lines changed: 19 additions & 2 deletions

File tree

‎.github/workflows/update-openssl.yml‎

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,11 @@ on:
55
- cron: 5 0 * * 0
66

77
workflow_dispatch:
8+
inputs:
9+
include_prereleases:
10+
description: Include prereleases
11+
type: boolean
12+
default: false
813

914
permissions:
1015
contents: read
@@ -41,6 +46,7 @@ jobs:
4146
shell: bash
4247
env:
4348
GITHUB_TOKEN: ${{ secrets.GH_USER_TOKEN }}
49+
INCLUDE_PRERELEASES: ${{ github.event_name == 'workflow_dispatch' && inputs.include_prereleases }}
4450
- name: Commit OpenSSL sources
4551
if: env.NEW_VERSION
4652
run: |

‎tools/dep_updaters/update-openssl.sh‎

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,9 +11,20 @@ cleanup() {
1111

1212
download() {
1313
LATEST_TAG_NAME="$("$NODE" --input-type=module <<'EOF'
14-
const res = await fetch('https://api.github.com/repos/openssl/openssl/git/matching-refs/tags/openssl-4.1');
14+
const res = await fetch('https://api.github.com/repos/openssl/openssl/git/matching-refs/tags/openssl-4.1.');
1515
if (!res.ok) throw new Error(`FetchError: ${res.status} ${res.statusText}`, { cause: res });
16-
const releases = await res.json()
16+
const includePrereleases = process.env.INCLUDE_PRERELEASES === 'true';
17+
const releases = (await res.json())
18+
.filter(({ ref }) => includePrereleases || /^refs\/tags\/openssl-\d+\.\d+\.\d+$/.test(ref))
19+
.sort(({ ref: a }, { ref: b }) => {
20+
const [, aVersion, aPrerelease] = a.split('-');
21+
const [, bVersion, bPrerelease] = b.split('-');
22+
const versionOrder = aVersion.localeCompare(bVersion, 'en', { numeric: true });
23+
if (versionOrder) return versionOrder;
24+
if (!aPrerelease) return bPrerelease ? 1 : 0;
25+
if (!bPrerelease) return -1;
26+
return aPrerelease.localeCompare(bPrerelease, 'en', { numeric: true });
27+
});
1728
const latest = releases.at(-1);
1829
if(!latest) throw new Error(`Could not find latest release`);
1930
console.log(latest.ref.replace('refs/tags/',''));

0 commit comments

Comments
 (0)