From 067973f0ac2c4f85a7e5bb241dfe37b92ee9dfa7 Mon Sep 17 00:00:00 2001 From: Alexander Trakhimenok Date: Wed, 11 Nov 2026 09:49:10 +0000 Subject: [PATCH] ci: automerge verified DataTug release patches --- .github/workflows/test.yml | 33 +++++++++++++++++++++--- renovate.json | 52 ++++++++++++++++++++++++++++++++++++++ 2 files changed, 81 insertions(+), 4 deletions(-) create mode 100644 renovate.json diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ec53e73..4b4a288 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -5,6 +5,8 @@ on: workflow_dispatch: permissions: contents: read +env: + DATATUG_VERSION: v0.153.1 jobs: test: strategy: @@ -14,16 +16,38 @@ jobs: runs-on: ${{ matrix.os }} steps: - uses: actions/checkout@3d3c42e5aac5ba805825da76410c181273ba90b1 # v7.0.1 + - name: Resolve the verified DataTug archive digest + id: release + shell: pwsh + env: + GH_TOKEN: ${{ github.token }} + run: | + $release = gh api "repos/datatug/datatug-cli/releases/tags/$env:DATATUG_VERSION" | ConvertFrom-Json + if ($LASTEXITCODE -ne 0 -or $release.tag_name -cne $env:DATATUG_VERSION -or + -not $release.immutable -or $release.draft -or $release.prerelease) { + throw 'expected a published immutable DataTug release' + } + $os = switch ($env:RUNNER_OS) { Linux { 'linux' } macOS { 'darwin' } Windows { 'windows' } } + $arch = switch ($env:RUNNER_ARCH) { X64 { 'amd64' } ARM64 { 'arm64' } } + if (-not $os -or -not $arch) { throw 'unsupported runner platform' } + $extension = if ($os -eq 'windows') { 'zip' } else { 'tar.gz' } + $version = $env:DATATUG_VERSION.Substring(1) + $asset = @($release.assets | Where-Object name -CEQ "datatug_${version}_${os}_${arch}.$extension") + if ($asset.Count -ne 1 -or $asset[0].digest -cnotmatch '^sha256:[a-f0-9]{64}$') { + throw 'missing or invalid archive digest' + } + Add-Content -Path $env:GITHUB_OUTPUT -Value "sha256=$($asset[0].digest.Substring(7))" - id: setup uses: ./ with: - version: v0.131.0 + version: ${{ env.DATATUG_VERSION }} + expected-sha256: ${{ steps.release.outputs.sha256 }} - name: Verify installed CLI shell: pwsh env: RESULT_VERSION: ${{ steps.setup.outputs.version }} run: | - if ($env:RESULT_VERSION -ne 'v0.131.0') { throw 'wrong output version' } + if ($env:RESULT_VERSION -cne $env:DATATUG_VERSION) { throw 'wrong output version' } $path = (Get-Command datatug).Source if (-not $path.StartsWith($env:RUNNER_TEMP, [StringComparison]::OrdinalIgnoreCase)) { throw "unexpected binary: $path" } $installDir = Split-Path $path @@ -31,12 +55,13 @@ jobs: if (-not (Test-Path (Join-Path $installDir $notice))) { throw "missing release notice: $notice" } } $reported = & datatug --version - if ($LASTEXITCODE -ne 0 -or $reported -notmatch '(^|[^0-9])0\.131\.0([^0-9]|$)') { throw "wrong binary version: $reported" } + $expectedVersion = [regex]::Escape($env:DATATUG_VERSION.Substring(1)) + if ($LASTEXITCODE -ne 0 -or $reported -notmatch "(^|[^0-9])${expectedVersion}([^0-9.]|$)") { throw "wrong binary version: $reported" } - id: wrong_digest continue-on-error: true uses: ./ with: - version: v0.131.0 + version: ${{ env.DATATUG_VERSION }} expected-sha256: '0000000000000000000000000000000000000000000000000000000000000000' - name: Assert failure shell: pwsh diff --git a/renovate.json b/renovate.json new file mode 100644 index 0000000..cc7c76d --- /dev/null +++ b/renovate.json @@ -0,0 +1,52 @@ +{ + "extends": [ + "config:recommended" + ], + "automerge": false, + "automergeType": "pr", + "platformAutomerge": true, + "prConcurrentLimit": 3, + "customManagers": [ + { + "customType": "regex", + "managerFilePatterns": [ + ".github/workflows/test.yml" + ], + "matchStrings": [ + "(?m)^ DATATUG_VERSION: (?v[0-9]+\\.[0-9]+\\.[0-9]+)$" + ], + "depNameTemplate": "datatug/datatug-cli", + "datasourceTemplate": "github-releases", + "versioningTemplate": "semver" + } + ], + "packageRules": [ + { + "matchManagers": [ + "custom.regex" + ], + "matchDatasources": [ + "github-releases" + ], + "matchPackageNames": [ + "datatug/datatug-cli" + ], + "matchUpdateTypes": [ + "patch" + ], + "automerge": true + }, + { + "matchUpdateTypes": [ + "major" + ], + "dependencyDashboardApproval": true + }, + { + "matchPackageNames": [ + "typescript" + ], + "allowedVersions": "<7" + } + ] +}