Skip to content

Commit

Permalink
Merge pull request #4 from franzs/feature_download_changelog_first
Browse files Browse the repository at this point in the history
Feature download changelog first
  • Loading branch information
franzs authored Aug 26, 2024
2 parents 88a1113 + d376c49 commit 8a8fcdc
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 10 deletions.
40 changes: 30 additions & 10 deletions .github/workflows/download-and-release-apk.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -9,13 +9,32 @@ on:
workflow_dispatch:

jobs:
download_apk:
download_changelog:
runs-on: ubuntu-latest

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

- name: Get changelog
run: |
changelog="changes.html"
url="https://www.juggluco.nl/Juggluco/${changelog}"
curl --location --output "${changelog}" "${url}"
echo "changelog=${changelog}" >> $GITHUB_ENV
- name: Store SHA256 hash of changelog
run: |
sha256sum "${{ env.changelog }}" | cut -d " " -f 1 > hash_changelog_new
echo "hash_changelog_current=$(cat hash_changelog_current)" >> $GITHUB_OUTPUT
echo "hash_changelog_new=$(cat hash_changelog_new)" >> $GITHUB_OUTPUT
download_apk:
runs-on: ubuntu-latest
needs: download_changelog
if: ${{ needs.build.outputs.hash_changelog_current != needs.build.outputs.hash_changelog_new }}

steps:
- name: Get apk from Google Drive
run: |
fileid="${{ vars.GOOGLE_DRIVE_FILE_ID }}"
Expand All @@ -26,20 +45,16 @@ jobs:
- name: Store SHA256 hash of apk
run: |
sha256sum "${{ env.filename }}" | cut -d " " -f 1 > hash_new_file
echo "current_hash=$(cat hash_current_file)" >> $GITHUB_OUTPUT
echo "new_hash=$(cat hash_new_file)" >> $GITHUB_OUTPUT
sha256sum "${{ env.filename }}" | cut -d " " -f 1 > hash_apk_new
echo "hash_apk_current=$(cat hash_apk_current)" >> $GITHUB_OUTPUT
echo "hash_apk_new=$(cat hash_apk_new)" >> $GITHUB_OUTPUT
release_apk:
runs-on: ubuntu-latest
needs: download_apk
if: ${{ needs.build.outputs.current_hash != needs.build.outputs.new_hash }}
if: ${{ needs.build.outputs.hash_apk_current != needs.build.outputs.hash_apk_new }}

steps:
- name: Update current hash
run: |
mv hash_new_file hash_current_file
# https://code.whatever.social/questions/13469147/get-android-apk-file-versionname-or-versioncode-without-installing-apk
- name: Find version number
run: |
Expand Down Expand Up @@ -69,11 +84,16 @@ jobs:
python "${python_dir}/parse_changelog.py" "${{ env.changelog }}" "${{ env.version }}" > "${changes_file}"
echo "changes_file=${changes_file}" >> $GITHUB_ENV
- name: Update current hashes
run: |
mv hash_changelog_new hash_changelog_current
mv hash_apk_new hash_apk_current
- name: Commit and push changes
uses: stefanzweifel/git-auto-commit-action@v5
with:
commit_message: "Update for version ${{ env.version }}"
file_pattern: "hash_current_file"
file_pattern: "hash_changelog_current hash_apk_current"

- name: Release apk
uses: softprops/action-gh-release@v2
Expand Down
File renamed without changes.
1 change: 1 addition & 0 deletions hash_changelog_current
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
bbebf64a0594fa9b6590154f8c533b0aac1af5da5c07e63f387a580d4da7239f changes.html

0 comments on commit 8a8fcdc

Please sign in to comment.