ci: run update docs workflow only if minor is released

This commit is contained in:
Nicolas Meienberger 2026-04-25 14:53:54 +02:00
parent eafcf2dd1f
commit f3eb072182
No known key found for this signature in database
2 changed files with 18 additions and 4 deletions

View file

@ -17,6 +17,7 @@ jobs:
outputs: outputs:
release_type: ${{ steps.set-type.outputs.release_type }} release_type: ${{ steps.set-type.outputs.release_type }}
tagname: ${{ github.ref_name }} tagname: ${{ github.ref_name }}
is_minor_release: ${{ steps.set-type.outputs.is_minor_release }}
steps: steps:
- name: Set release type - name: Set release type
id: set-type id: set-type
@ -30,6 +31,12 @@ jobs:
echo "release_type=release" >> $GITHUB_OUTPUT echo "release_type=release" >> $GITHUB_OUTPUT
fi fi
if [[ $TAG =~ ^v[0-9]+\.[0-9]+\.0$ ]]; then
echo "is_minor_release=true" >> $GITHUB_OUTPUT
else
echo "is_minor_release=false" >> $GITHUB_OUTPUT
fi
checks: checks:
uses: ./.github/workflows/checks.yml uses: ./.github/workflows/checks.yml
@ -151,7 +158,7 @@ jobs:
request-docs-version-update: request-docs-version-update:
uses: ./.github/workflows/request-docs-version-update.yml uses: ./.github/workflows/request-docs-version-update.yml
needs: [publish-release, determine-release-type] needs: [publish-release, determine-release-type]
if: needs.determine-release-type.outputs.release_type == 'release' if: needs.determine-release-type.outputs.release_type == 'release' && needs.determine-release-type.outputs.is_minor_release == 'true'
with: with:
release_tag: ${{ needs.determine-release-type.outputs.tagname }} release_tag: ${{ needs.determine-release-type.outputs.tagname }}
base_branch: ${{ github.event.repository.default_branch }} base_branch: ${{ github.event.repository.default_branch }}

View file

@ -4,7 +4,7 @@ on:
workflow_dispatch: workflow_dispatch:
inputs: inputs:
release_tag: release_tag:
description: Release tag to update documentation examples to description: Minor release tag, for example v0.35.0
required: true required: true
type: string type: string
base_branch: base_branch:
@ -44,10 +44,17 @@ jobs:
const releaseTag = process.env.RELEASE_TAG; const releaseTag = process.env.RELEASE_TAG;
const baseBranch = process.env.BASE_BRANCH; const baseBranch = process.env.BASE_BRANCH;
const minorRelease = releaseTag.match(/^(v\d+\.\d+)\.0$/);
if (!minorRelease) {
core.setFailed(`Docs version updates only run for minor release tags like v0.35.0. Received: ${releaseTag}`);
return;
}
const docsVersion = minorRelease[1];
const { owner, repo } = context.repo; const { owner, repo } = context.repo;
const targetRepo = `${owner}/${repo}`; const targetRepo = `${owner}/${repo}`;
const releaseUrl = `https://github.com/${targetRepo}/releases/tag/${releaseTag}`; const releaseUrl = `https://github.com/${targetRepo}/releases/tag/${releaseTag}`;
const title = `Update Docker Compose examples to ${releaseTag}`; const title = `Update Docker Compose examples to ${docsVersion}`;
const bodyLines = [ const bodyLines = [
`A new Zerobyte release was published: ${releaseTag}`, `A new Zerobyte release was published: ${releaseTag}`,
"", "",
@ -56,7 +63,7 @@ jobs:
"Please create a pull request that updates Docker Compose documentation examples to use:", "Please create a pull request that updates Docker Compose documentation examples to use:",
"", "",
"```yaml", "```yaml",
`image: ghcr.io/nicotsx/zerobyte:${releaseTag}`, `image: ghcr.io/nicotsx/zerobyte:${docsVersion}`,
"```", "```",
"", "",
"Scope:", "Scope:",