use a min version

This commit is contained in:
cupcakearmy 2022-11-01 21:03:21 +01:00
parent 0324ed6d49
commit 6af204ca70
No known key found for this signature in database
GPG Key ID: 3235314B4D31232F
3 changed files with 36 additions and 9 deletions

View File

@ -1,4 +1,5 @@
import { info, setOutput } from '@actions/core' import { info, setOutput } from '@actions/core'
import semver from 'semver'
// Fetch the current versions from the download page // Fetch the current versions from the download page
const URL = `https://nginx.org/en/download.html` const URL = `https://nginx.org/en/download.html`
@ -12,8 +13,12 @@ const matches = html.match(re)
const clean = (match) => match.replace(/"/g, '').replace('/download/nginx-', '').replace('.tar.gz', '') const clean = (match) => match.replace(/"/g, '').replace('/download/nginx-', '').replace('.tar.gz', '')
const versions = matches.map(clean) const versions = matches.map(clean)
// Filter
const MIN_VERSION = '1.20.0'
const filtered = versions.filter((v) => semver.gte(v, MIN_VERSION))
// Map the docker tags to the versions // Map the docker tags to the versions
const tagsMap = Object.fromEntries(versions.map((v) => [v, v])) const tagsMap = Object.fromEntries(filtered.map((v) => [v, v]))
// Add the mainline, stable and latests tags // Add the mainline, stable and latests tags
tagsMap['latest'] = versions[0] tagsMap['latest'] = versions[0]

View File

@ -1,5 +1,6 @@
{ {
"dependencies": { "devDependencies": {
"@actions/core": "^1.10.0" "@actions/core": "^1.10.0",
} "semver": "^7.3.8"
}
} }

31
pnpm-lock.yaml generated
View File

@ -2,9 +2,11 @@ lockfileVersion: 5.4
specifiers: specifiers:
'@actions/core': ^1.10.0 '@actions/core': ^1.10.0
semver: ^7.3.8
dependencies: devDependencies:
'@actions/core': 1.10.0 '@actions/core': 1.10.0
semver: 7.3.8
packages: packages:
@ -13,20 +15,39 @@ packages:
dependencies: dependencies:
'@actions/http-client': 2.0.1 '@actions/http-client': 2.0.1
uuid: 8.3.2 uuid: 8.3.2
dev: false dev: true
/@actions/http-client/2.0.1: /@actions/http-client/2.0.1:
resolution: {integrity: sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==} resolution: {integrity: sha512-PIXiMVtz6VvyaRsGY268qvj57hXQEpsYogYOu2nrQhlf+XCGmZstmuZBbAybUl1nQGnvS1k1eEsQ69ZoD7xlSw==}
dependencies: dependencies:
tunnel: 0.0.6 tunnel: 0.0.6
dev: false dev: true
/lru-cache/6.0.0:
resolution: {integrity: sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==}
engines: {node: '>=10'}
dependencies:
yallist: 4.0.0
dev: true
/semver/7.3.8:
resolution: {integrity: sha512-NB1ctGL5rlHrPJtFDVIVzTyQylMLu9N9VICA6HSFJo8MCGVTMW6gfpicwKmmK/dAjTOrqu5l63JJOpDSrAis3A==}
engines: {node: '>=10'}
hasBin: true
dependencies:
lru-cache: 6.0.0
dev: true
/tunnel/0.0.6: /tunnel/0.0.6:
resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==} resolution: {integrity: sha512-1h/Lnq9yajKY2PEbBadPXj3VxsDDu844OnaAo52UVmIzIvwwtBPIuNvkjuzBlTWpfJyUbG3ez0KSBibQkj4ojg==}
engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'} engines: {node: '>=0.6.11 <=0.7.0 || >=0.7.3'}
dev: false dev: true
/uuid/8.3.2: /uuid/8.3.2:
resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==} resolution: {integrity: sha512-+NYs2QeMWy+GWFOEm9xnn6HCDp0l7QBD7ml8zLUmJ+93Q5NF0NocErnwkTkXVFNiX3/fpC6afS8Dhb/gz7R7eg==}
hasBin: true hasBin: true
dev: false dev: true
/yallist/4.0.0:
resolution: {integrity: sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==}
dev: true