Skip to content

Commit

Permalink
ci: Simplify release workflow and fix issue
Browse files Browse the repository at this point in the history
  • Loading branch information
cyb3rko committed Feb 1, 2024
1 parent 6e4a94f commit 5e43169
Show file tree
Hide file tree
Showing 2 changed files with 21 additions and 24 deletions.
30 changes: 15 additions & 15 deletions .github/perf-impr-calc.py
Original file line number Diff line number Diff line change
Expand Up @@ -30,19 +30,19 @@ def get_file_line_count():

average_percentage = round(coefficient * 100 / row_count, 2)
print("Average performance enhancement:", average_percentage)
changelog = os.getenv("CHANGELOG")
# changelog = open("changelog.txt", "r", encoding="utf-8").read()
marker = "<<marker1>>"
first_index = changelog.find(marker)
if first_index == -1:
raise Exception("Position marker not found")

last_index = first_index + len(marker)
print(f"Marker index at {first_index}")

print("Writing changelog output")
changelog = changelog[:first_index] + str(average_percentage) + "%" + changelog[last_index:]
print(f'::set-output name=changelog::{changelog}') # Access via steps.github_release2.outputs.changelog
# with open("changelog.txt", "w", encoding="utf-8") as file:
# file.write(changelog)
# changelog = os.getenv("CHANGELOG")
# # changelog = open("changelog.txt", "r", encoding="utf-8").read()
# marker = "<<marker1>>"
# first_index = changelog.find(marker)
# if first_index == -1:
# raise Exception("Position marker not found")
#
# last_index = first_index + len(marker)
# print(f"Marker index at {first_index}")
#
# print("Writing changelog output")
# changelog = changelog[:first_index] + str(average_percentage) + "%" + changelog[last_index:]
# env_file = os.getenv('GITHUB_ENV')
# with open(env_file, "a") as file:
# file.write(f"NEW_CHANGELOG={changelog}")

15 changes: 6 additions & 9 deletions .github/workflows/release-builder.yml
Original file line number Diff line number Diff line change
Expand Up @@ -77,26 +77,23 @@ jobs:
]
}
- name: Echo Changelog
env:
CHANGELOG: ${{ steps.github_release.outputs.changelog }}
run: echo "$CHANGELOG"

- name: Set release name
run: echo "RELEASE_VERSION=${GITHUB_REF#refs/tags/v}" >> $GITHUB_ENV

- name: Checkout repo
uses: actions/checkout@v4

- name: Calculate and insert performance calculation
id: github_release2
shell: sh
env:
CHANGELOG: ${{ steps.github_release.outputs.changelog }}
run: |
cd .github
python perf-impr-calc.py
- name: Echo Changelog
env:
CHANGELOG: ${{ steps.github_release2.outputs.changelog }}
run: echo "$CHANGELOG"

- name: Setup JDK
uses: actions/setup-java@v4
with:
Expand Down Expand Up @@ -127,5 +124,5 @@ jobs:
uses: softprops/action-gh-release@v1
with:
name: "Version ${{ env.RELEASE_VERSION }}"
body: ${{steps.github_release2.outputs.changelog}}
body: ${{steps.github_release.outputs.changelog}}
files: app/build/outputs/apk/release/FlashDim-${{env.RELEASE_VERSION}}.apk

0 comments on commit 5e43169

Please sign in to comment.