mirror of
https://github.com/docker/setup-docker-action.git
synced 2026-11-16 17:37:35 -06:00
Merge pull request #355 from crazy-max/ci-automate-docker-version-updates
ci: update docker to 29.9.3 and automate version updates
This commit is contained in:
2 files changed
+34
-34
No files matched your search
@@ -20,7 +20,7 @@ on:
|
|||||||
pull_request:
|
pull_request:
|
||||||
|
|
||||||
env:
|
env:
|
||||||
DOCKER_VERSION: v27.3.1
|
DOCKER_VERSION: v29.9.3
|
||||||
DOCKER_BUILD_SUMMARY: false
|
DOCKER_BUILD_SUMMARY: false
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
@@ -36,8 +36,8 @@ jobs:
|
|||||||
- windows-latest
|
- windows-latest
|
||||||
version:
|
version:
|
||||||
- ""
|
- ""
|
||||||
- v27.3.1
|
- v29.9.3
|
||||||
- type=image,tag=27.3.1
|
- type=image,tag=29.9.3
|
||||||
steps:
|
steps:
|
||||||
-
|
-
|
||||||
name: Checkout
|
name: Checkout
|
||||||
@@ -325,23 +325,3 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
UNDOCK_VERSION: ${{ matrix.undock_version }}
|
UNDOCK_VERSION: ${{ matrix.undock_version }}
|
||||||
REGCTL_VERSION: ${{ matrix.regctl_version }}
|
REGCTL_VERSION: ${{ matrix.regctl_version }}
|
||||||
|
|
||||||
docker-29:
|
|
||||||
runs-on: ${{ matrix.os }}
|
|
||||||
strategy:
|
|
||||||
fail-fast: false
|
|
||||||
matrix:
|
|
||||||
os:
|
|
||||||
- ubuntu-latest
|
|
||||||
- macos-26-large
|
|
||||||
- windows-latest
|
|
||||||
steps:
|
|
||||||
-
|
|
||||||
name: Checkout
|
|
||||||
uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1
|
|
||||||
-
|
|
||||||
name: Set up Docker
|
|
||||||
uses: ./
|
|
||||||
with:
|
|
||||||
version: v29.0.0-rc.1
|
|
||||||
channel: test
|
|
||||||
@@ -27,6 +27,7 @@ jobs:
|
|||||||
fail-fast: false
|
fail-fast: false
|
||||||
matrix:
|
matrix:
|
||||||
dep:
|
dep:
|
||||||
|
- docker
|
||||||
- regctl
|
- regctl
|
||||||
- undock
|
- undock
|
||||||
steps:
|
steps:
|
||||||
@@ -91,6 +92,12 @@ jobs:
|
|||||||
}
|
}
|
||||||
|
|
||||||
const dependencyConfigs = {
|
const dependencyConfigs = {
|
||||||
|
docker: {
|
||||||
|
name: 'Docker version',
|
||||||
|
branch: 'deps/docker-version',
|
||||||
|
sourcePath: '.github/docker-releases.json',
|
||||||
|
sourceUrl: 'https://github.com/docker/actions-toolkit/blob/main/.github/docker-releases.json'
|
||||||
|
},
|
||||||
regctl: {
|
regctl: {
|
||||||
name: 'Regctl version',
|
name: 'Regctl version',
|
||||||
branch: 'deps/regctl-version',
|
branch: 'deps/regctl-version',
|
||||||
@@ -113,22 +120,32 @@ jobs:
|
|||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const version = await readLatestTag(config.sourcePath);
|
const tag = await readLatestTag(config.sourcePath);
|
||||||
const targetPath = 'src/main.ts';
|
const version = dep === 'docker' ? tag.replace(/^docker-/, '') : tag;
|
||||||
|
const targetPath = dep === 'docker' ? '.github/workflows/ci.yml' : 'src/main.ts';
|
||||||
const absolutePath = path.join(process.env.GITHUB_WORKSPACE, targetPath);
|
const absolutePath = path.join(process.env.GITHUB_WORKSPACE, targetPath);
|
||||||
const content = fs.readFileSync(absolutePath, 'utf8');
|
const content = fs.readFileSync(absolutePath, 'utf8');
|
||||||
const pattern = tsConstStringPattern(config.key);
|
const replacements = dep === 'docker' ? [
|
||||||
const match = content.match(pattern);
|
{pattern: /^( DOCKER_VERSION: )(v\S+)()$/m, version},
|
||||||
if (!match) {
|
{pattern: /^( - )(v\S+)()$/m, version},
|
||||||
throw new Error(`Missing ${config.key} in ${targetPath}`);
|
{pattern: /^( - type=image,tag=)(\S+)()$/m, version: version.replace(/^v/, '')}
|
||||||
|
] : [{pattern: tsConstStringPattern(config.key), version}];
|
||||||
|
let updatedContent = content;
|
||||||
|
let previousVersion;
|
||||||
|
for (const replacement of replacements) {
|
||||||
|
const match = updatedContent.match(replacement.pattern);
|
||||||
|
if (!match) {
|
||||||
|
throw new Error(`Missing ${replacement.pattern} in ${targetPath}`);
|
||||||
|
}
|
||||||
|
previousVersion ??= match[2];
|
||||||
|
updatedContent = updatedContent.replace(replacement.pattern, (_, prefix, current, suffix) => `${prefix}${replacement.version}${suffix}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const previousVersion = match[2];
|
const changed = updatedContent !== content;
|
||||||
const changed = previousVersion !== version;
|
|
||||||
if (changed) {
|
if (changed) {
|
||||||
fs.writeFileSync(
|
fs.writeFileSync(
|
||||||
absolutePath,
|
absolutePath,
|
||||||
content.replace(pattern, `$1${version}$3`),
|
updatedContent,
|
||||||
'utf8'
|
'utf8'
|
||||||
);
|
);
|
||||||
core.info(`New ${config.name} ${version} found`);
|
core.info(`New ${config.name} ${version} found`);
|
||||||
@@ -143,9 +160,12 @@ jobs:
|
|||||||
core.setOutput('before', previousVersion);
|
core.setOutput('before', previousVersion);
|
||||||
core.setOutput('after', version);
|
core.setOutput('after', version);
|
||||||
core.setOutput('source-url', config.sourceUrl);
|
core.setOutput('source-url', config.sourceUrl);
|
||||||
|
core.setOutput('description', dep === 'docker'
|
||||||
|
? `This updates the pinned Docker version in \`${targetPath}\` from \`${previousVersion}\` to \`${version}\`, including the binary and image test matrix entries.`
|
||||||
|
: `This updates the pinned default in \`${targetPath}\` from \`${previousVersion}\` to \`${version}\` and refreshes generated \`dist\` content.`);
|
||||||
-
|
-
|
||||||
name: Build
|
name: Build
|
||||||
if: steps.update.outputs.changed == 'true'
|
if: steps.update.outputs.changed == 'true' && matrix.dep != 'docker'
|
||||||
uses: docker/bake-action@018cb6412ab401ebaa809aa5f85966b74628600f # v7.4.0
|
uses: docker/bake-action@018cb6412ab401ebaa809aa5f85966b74628600f # v7.4.0
|
||||||
with:
|
with:
|
||||||
source: .
|
source: .
|
||||||
@@ -163,6 +183,6 @@ jobs:
|
|||||||
sign-commits: true
|
sign-commits: true
|
||||||
delete-branch: true
|
delete-branch: true
|
||||||
body: |
|
body: |
|
||||||
This updates the pinned default in `src/main.ts` from `${{ steps.update.outputs.before }}` to `${{ steps.update.outputs.after }}` and refreshes generated `dist` content.
|
${{ steps.update.outputs.description }}
|
||||||
|
|
||||||
The source of truth for this update is ${{ steps.update.outputs.source-url }}.
|
The source of truth for this update is ${{ steps.update.outputs.source-url }}.
|
||||||
Reference in new issue
Block a user