Skip to content

Commit

Permalink
[GH Actions] Fix attempt 1
Browse files Browse the repository at this point in the history
  • Loading branch information
dragonx943 committed Nov 28, 2024
1 parent a18c125 commit 5f9b6c6
Showing 1 changed file with 18 additions and 19 deletions.
37 changes: 18 additions & 19 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -99,29 +99,28 @@ jobs:
files: ${{ env.SIGNED_APK }}
prerelease: false

- name: Update Documents and Done!
- name: Cleanup working directory
run: |
git clean -fdx
git reset --hard
git fetch origin nightly
git checkout nightly
VERSION="${{ steps.tagger.outputs.new_tag }}"
NUMBERS=()
for (( i=0; i<${#VERSION}; i++ )); do
NUMBERS+=("${VERSION:$i:1}")
done
README_CONTENT=$(cat README.md)
COUNTER_SECTION="### [Latest Version of Kotatsu Nightly](https://github.com/KotatsuApp/kotatsu-nightly/releases/latest)\n"
for num in "${NUMBERS[@]}"; do
COUNTER_SECTION+="[![Download](https://rule34.xxx/counter/$num.gif)](https://github.com/KotatsuApp/kotatsu-nightly/releases/latest) "
- name: Update documents
run: |
VERSION_NUMBER="${{ steps.tagger.outputs.new_tag }}"
COUNTER_LINKS=""
for (( i=0; i<${#VERSION_NUMBER}; i++ )); do
DIGIT="${VERSION_NUMBER:$i:1}"
COUNTER_LINKS+="[![Download](https://rule34.xxx/counter/$DIGIT.gif)](https://github.com/KotatsuApp/kotatsu-nightly/releases/latest) "
done
sed -i "/### \[Latest Version of Kotatsu Nightly\]/,/\[Download\]/c\\$COUNTER_SECTION" README.md
git config --global user.name 'github-actions[bot]'
git config --global user.email 'github-actions[bot]@users.noreply.github.com'
sed -i "/### \[Latest Version of Kotatsu Nightly\]/,/^$/c\### [Latest Version of Kotatsu Nightly](https://github.com/KotatsuApp/kotatsu-nightly/releases/latest)\n${COUNTER_LINKS}\n" README.md
- name: Commit and push changes
run: |
git config --local user.email "github-actions[bot]@users.noreply.github.com"
git config --local user.name "github-actions[bot]"
git add README.md
git commit -m "Update build number to $VERSION"
git commit -m "Update version counter to ${{ steps.tagger.outputs.new_tag }}"
git push origin nightly

0 comments on commit 5f9b6c6

Please sign in to comment.