Skip to content

Commit d68527d

Browse files
authored
PMM-7 Fix release-doc workflow (#5008)
* PMM-7 Fix release-doc workflow * PMM-7 fix the release title * PMM-7 Clean up
1 parent b659779 commit d68527d

File tree

1 file changed

+3
-77
lines changed

1 file changed

+3
-77
lines changed

.github/workflows/release-doc.yml

Lines changed: 3 additions & 77 deletions
Original file line numberDiff line numberDiff line change
@@ -25,84 +25,12 @@ permissions:
2525
contents: read
2626

2727
jobs:
28-
merge-docs:
29-
permissions:
30-
contents: write # for git push operations
31-
32-
if: (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && github.repository == 'percona/pmm'
33-
runs-on: ubuntu-22.04
34-
35-
steps:
36-
- name: Set version for testing
37-
id: set_version
38-
run: |
39-
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
40-
echo "version=${{ inputs.version }}" >> $GITHUB_OUTPUT
41-
echo "source_branch=${{ inputs.source_branch }}" >> $GITHUB_OUTPUT
42-
echo "target_docs_branch=${{ inputs.target_docs_branch }}" >> $GITHUB_OUTPUT
43-
echo "Testing with version: ${{ inputs.version }}"
44-
echo "Target docs branch: ${{ inputs.target_docs_branch }}"
45-
else
46-
version="${{ github.ref }}"
47-
version="${version/refs\/tags\/v/}"
48-
echo "version=$version" >> $GITHUB_OUTPUT
49-
echo "source_branch=" >> $GITHUB_OUTPUT
50-
echo "target_docs_branch=v3" >> $GITHUB_OUTPUT
51-
echo "Release with version: $version"
52-
fi
53-
54-
- name: Checkout repository
55-
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2
56-
with:
57-
fetch-depth: 0
58-
59-
- name: Merge pmm-version branch into target docs branch
60-
shell: bash
61-
run: |
62-
version="${{ steps.set_version.outputs.version }}"
63-
source_branch="${{ steps.set_version.outputs.source_branch }}"
64-
target_docs_branch="${{ steps.set_version.outputs.target_docs_branch }}"
65-
66-
# Use source branch if provided, otherwise use pmm-$version
67-
if [ -n "$source_branch" ]; then
68-
merge_source_branch="$source_branch"
69-
echo "Using specified source branch: $merge_source_branch"
70-
else
71-
merge_source_branch="pmm-$version"
72-
echo "Using standard branch: $merge_source_branch"
73-
fi
74-
75-
echo "Target documentation branch: $target_docs_branch"
76-
77-
# Configure git
78-
git config user.name "GitHub Action"
79-
git config user.email "[email protected]"
80-
81-
# Check if branch exists
82-
if git ls-remote --heads origin $merge_source_branch | grep -q $merge_source_branch; then
83-
echo "Found $merge_source_branch branch, merging into $target_docs_branch..."
84-
85-
# Checkout target docs branch
86-
git checkout $target_docs_branch || git checkout -b $target_docs_branch origin/$target_docs_branch
87-
88-
# Merge branch
89-
git merge origin/$merge_source_branch --no-ff -m "Merge $merge_source_branch into $target_docs_branch for release $version"
90-
91-
# Push the merge
92-
git push origin $target_docs_branch
93-
94-
echo "Successfully merged $merge_source_branch into $target_docs_branch"
95-
else
96-
echo "$merge_source_branch branch not found, skipping merge"
97-
fi
98-
9928
release:
10029
permissions:
10130
contents: write # for softprops/action-gh-release to create GitHub release
10231

10332
if: (startsWith(github.ref, 'refs/tags/') || github.event_name == 'workflow_dispatch') && github.repository == 'percona/pmm'
10433
runs-on: ubuntu-22.04
105-
needs: merge-docs
10634
steps:
10735
- name: Set version for testing
10836
id: set_version
@@ -156,7 +84,7 @@ jobs:
15684
echo "Changelog content preview:"
15785
head -5 ${{ github.workspace }}-CHANGELOG.txt
15886
159-
- name: Convert mkdocs
87+
- name: Convert from mkdocs to GitHub markdown
16088
shell: bash --noprofile --norc -ex {0}
16189
run: |
16290
grep -rl '!!! caution' ${{ github.workspace }}-CHANGELOG.txt | xargs --no-run-if-empty sed -i 's/\!\!\! caution alert alert-warning "\(.*\)"/\> \:warning\: **\1**/g'
@@ -170,7 +98,5 @@ jobs:
17098
with:
17199
body_path: ${{ github.workspace }}-CHANGELOG.txt
172100
draft: true
173-
tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}-test', steps.set_version.outputs.version) || github.ref_name }}
174-
name: ${{ github.event_name == 'workflow_dispatch' && format('Test Release v{0}', steps.set_version.outputs.version) || format('Release {0}', github.ref_name) }}
175-
176-
101+
tag_name: ${{ github.event_name == 'workflow_dispatch' && format('v{0}', steps.set_version.outputs.version) || github.ref_name }}
102+
name: ${{ github.event_name == 'workflow_dispatch' && format('Release v{0}', steps.set_version.outputs.version) || format('Release {0}', github.ref_name) }}

0 commit comments

Comments
 (0)