Skip to content

Commit

Permalink
Attempt to use $GITHUB_OUTPUT (#12)
Browse files Browse the repository at this point in the history
  • Loading branch information
seljabali committed Apr 27, 2024
1 parent 83b48d7 commit 4b47b53
Show file tree
Hide file tree
Showing 2 changed files with 23 additions and 24 deletions.
12 changes: 6 additions & 6 deletions .github/scripts/generate_release_notes.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ def get_commits_since_last_tag():
return commit_logs

def generate_release_notes():
notes = "### ✨ Enhancements\n"
notes = "### ✨ Enhancements\\n"
commit_logs = get_commits_since_last_tag()
authorsSet = set()
dependabotNotes = ''
Expand All @@ -67,21 +67,21 @@ def generate_release_notes():
# Attempt to extract PR number from commit message
pr_match = re.search(r'\(#(\d+)\)', message)
pr_number = pr_match.group(1) if pr_match else ''
commitNote = f"* {message}\n"
commitNote = f"* {message}\\n"
if dependabot in author:
dependabotNotes += commitNote
else:
notes += commitNote
authorsSet.add(author)
else:
notes += "No changes were made since the last release.\n"
notes += "No changes were made since the last release.\\n"

if dependabotNotes != "":
notes += "### 🔨 Dependencies\n"
notes += "### 🔨 Dependencies\\n"
notes += dependabotNotes

notes += "\n\nThanks to " + getAuthorHandlesFromNames(authorsSet)
notes += "\n\nChange log " + repoUrl + "/compare/" + get_latest_tag() + "..." + calculate_next_tag()
notes += "\\n\\nThanks to " + getAuthorHandlesFromNames(authorsSet)
notes += "\\n\\nChange log " + repoUrl + "/compare/" + get_latest_tag() + "..." + calculate_next_tag()
return notes

if __name__ == "__main__":
Expand Down
35 changes: 17 additions & 18 deletions .github/workflows/create-tag-and-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
- name: Setup Python
uses: actions/setup-python@v5
with:
python-version: '3.x'
python-version: "3.x"

- name: Install dependencies
run: pip install PyYAML
Expand All @@ -28,14 +28,14 @@ jobs:
run: echo "tag=$(python .github/scripts/calculate_next_tag.py)" >> $GITHUB_OUTPUT
shell: bash

- name: Generate release notes
id: generate-notes
run: |
NOTES=$(python .github/scripts/generate_release_notes.py)
NOTES="${NOTES//'%'/'%25'}"
NOTES="${NOTES//$'\n'/'%0A'}"
NOTES="${NOTES//$'\r'/'%0D'}"
echo "::set-output name=notes::$NOTES"
# - name: Generate release notes
# id: generate-notes
# run: |
# NOTES=$(python .github/scripts/generate_release_notes.py)
# NOTES="${NOTES//'%'/'%25'}"
# NOTES="${NOTES//$'\n'/'%0A'}"
# NOTES="${NOTES//$'\r'/'%0D'}"
# echo "::set-output name=notes::$NOTES"

# - name: Generate release notes v1
# id: generate-notes-v1
Expand Down Expand Up @@ -66,12 +66,12 @@ jobs:
# NOTES=$(python .github/scripts/generate_release_notes.py | base64)
# echo "notes=$NOTES" >> $GITHUB_OUTPUT

# - name: Generate release notes
# id: generate-notes
# run: |
# echo "notes<<EOF" >> $GITHUB_OUTPUT
# python .github/scripts/generate_release_notes.py'
# echo "EOF" >> $GITHUB_OUTPUT
- name: Generate release notes
id: generate-notes
run: |
echo "notes<<EOF" >> $GITHUB_OUTPUT
python .github/scripts/generate_release_notes.py'
echo "EOF" >> $GITHUB_OUTPUT
- name: Create the new tag
run: |
Expand All @@ -80,15 +80,14 @@ jobs:
git tag ${{ steps.next-tag.outputs.tag }}
git push origin ${{ steps.next-tag.outputs.tag }}
- name: Release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
draft: false
prerelease: false
generate_release_notes: false
generate_release_notes: false
make_latest: true
tag_name: ${{ steps.next-tag.outputs.tag }}
name: ${{ steps.next-tag.outputs.tag }}
Expand Down

0 comments on commit 4b47b53

Please sign in to comment.