From 2b84c86d45d3492d4cbe635ab92031f3a7d38519 Mon Sep 17 00:00:00 2001 From: cupcakearmy Date: Tue, 1 Nov 2022 21:46:50 +0100 Subject: [PATCH] separate with ; --- .github/workflows/trial.yml | 1 + tags/index.js | 23 +++++++++++------------ 2 files changed, 12 insertions(+), 12 deletions(-) diff --git a/.github/workflows/trial.yml b/.github/workflows/trial.yml index a221561..84f1e82 100644 --- a/.github/workflows/trial.yml +++ b/.github/workflows/trial.yml @@ -58,6 +58,7 @@ jobs: cupcakearmy/breitbandbot ghcr.io/${{ github.repository }} tags: ${{ matrix.tags }} + sep-tags: ";" - name: Build and push id: docker_build diff --git a/tags/index.js b/tags/index.js index f133bf4..ad05748 100644 --- a/tags/index.js +++ b/tags/index.js @@ -10,28 +10,27 @@ const re = /"\/download\/nginx-(\d+\.){3}tar\.gz"/g const matches = html.match(re) // Clean up the matches to semver format -const clean = (match) => match.replace(/"/g, '').replace('/download/nginx-', '').replace('.tar.gz', '') +function clean(match) { + return match.replace(/"/g, '').replace('/download/nginx-', '').replace('.tar.gz', '') +} const versions = matches.map(clean) // Filter // Get the two most up to date versions, mainline and stable const filtered = versions.sort(semver.rcompare).slice(0, 2) -// Map the docker tags to the versions -// const tagsMap = Object.fromEntries(filtered.map((v) => [v, v])) - -// Add the mainline, stable and latests tags -// tagsMap['latest'] = versions[0] -// tagsMap['mainline'] = versions[0] -// tagsMap['stable'] = versions[1] +// Set the tags with a delimiter of ";" +function convert(version, additional = []) { + return { + version, + tags: [version, ...additional].join(';'), + } +} // Export as github action matrix // https://docs.github.com/en/actions/using-jobs/using-a-matrix-for-your-jobs#expanding-or-adding-matrix-configurations const githubActionMatrix = { - include: [ - { version: filtered[0], tags: ['latest', 'mainline', filtered[0]] }, - { version: filtered[1], tags: ['stable', filtered[1]] }, - ], + include: [convert(versions[0], ['latest', 'mainline']), convert(versions[1], ['stable'])], } const serialised = JSON.stringify(githubActionMatrix)