Skip to content

Commit 6fcda9e

Browse files
committed
workflow adjusted
1 parent 7455621 commit 6fcda9e

File tree

2 files changed

+8
-21
lines changed

2 files changed

+8
-21
lines changed

.github/workflows/deploy.yml

Lines changed: 8 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -11,21 +11,21 @@ jobs:
1111
tag:
1212
name: Prepare Release
1313
runs-on: ubuntu-latest
14-
if: github.event_name == 'push' # Only run on push events
14+
if: github.event_name == 'push'
1515

1616
steps:
1717
- uses: actions/checkout@v3
1818
with:
19-
fetch-depth: 0 # Important: Fetch all history for tags
19+
fetch-depth: 0
2020

2121
- name: Get latest commit SHA
2222
id: sha
23-
if: github.ref == 'refs/heads/master' # Only when pushing to master
23+
if: github.ref == 'refs/heads/master'
2424
run: echo "::set-output name=sha::$(git rev-parse HEAD)"
2525

2626
- name: Create Tag (if needed)
2727
id: create_tag
28-
if: github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'Merge pull request') #Only on direct pushes to master, not merge commits
28+
if: github.ref == 'refs/heads/master' && !startsWith(github.event.head_commit.message, 'Merge pull request')
2929
run: |
3030
TAG_NAME="v$(date +%Y%m%d%H%M%S)-${{ steps.sha.outputs.sha }}"
3131
git config --global user.name 'GitHub Actions'
@@ -38,69 +38,56 @@ jobs:
3838
id: release_notes
3939
if: github.event_name == 'push' && (github.ref == 'refs/heads/master' || startsWith(github.ref, 'refs/tags/'))
4040
run: |
41-
# Define variables
4241
changelog_section_start="== Changelog =="
43-
current_tag="${{ steps.create_tag.outputs.tag || github.ref_name }}" # Use created tag or existing tag
44-
readme_file=$(find . -type f -iname "readme.*" | head -n 1)
42+
current_tag="${{ steps.create_tag.outputs.tag || github.ref_name }}"
43+
readme_file="readme.txt" # Directly set the filename
4544
46-
if [ -z "$readme_file" ]; then
47-
echo "::error::Readme file not found."
45+
if [ ! -f "$readme_file" ]; then # Check if the file exists
46+
echo "::error::Readme file not found: $readme_file"
4847
exit 1
4948
fi
5049
echo "Readme file: $readme_file"
5150
52-
# Extract version from tag
5351
version=${current_tag#refs/tags/}
5452
55-
# Initialize variables
5653
in_changelog=0
5754
capturing_version=0
5855
release_notes=""
5956
6057
while IFS= read -r line; do
61-
# Start capturing after finding the changelog section
6258
if [[ "$line" == "$changelog_section_start" ]]; then
6359
in_changelog=1
6460
continue
6561
fi
6662
67-
# Skip lines before the changelog section
6863
if [[ $in_changelog -eq 0 ]]; then
6964
continue
7065
fi
7166
72-
# Start capturing if the line starts with a version number (semver format)
7367
if [[ "$line" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
7468
capturing_version=1
75-
# Check if the captured version matches the current tag
7669
if [[ "$line" == "$version" ]]; then
7770
release_notes+="$line\n"
7871
fi
7972
continue
8073
fi
8174
82-
# Stop capturing when a new version section is detected
8375
if [[ $capturing_version -eq 1 && "$line" =~ ^[0-9]+\.[0-9]+\.[0-9]+ ]]; then
8476
break
8577
fi
8678
87-
# Add the line to the release notes if capturing the current version
8879
if [[ $capturing_version -eq 1 ]]; then
8980
release_notes+="$line\n"
9081
fi
9182
done < "$readme_file"
9283
93-
# Check if release notes were extracted
9484
if [[ -z "$release_notes" ]]; then
9585
echo "::error::Failed to extract release notes for version $version."
9686
exit 1
9787
fi
9888
99-
# Debug: Print extracted release notes
10089
echo "Extracted release notes for version $version:"
10190
printf "%b" "$release_notes"
102-
103-
# Set output for release notes
10491
echo "::set-output name=notes::$(printf "%b" "$release_notes")"
10592
10693
- name: Create GitHub Release
File renamed without changes.

0 commit comments

Comments
 (0)