Skip to content

Commit

Permalink
Merge pull request #19 from litetex/better-versioning
Browse files Browse the repository at this point in the history
Improve versioning of built APK
  • Loading branch information
litetex authored Oct 28, 2024
2 parents 765c9fe + 90924cc commit 7018b09
Showing 1 changed file with 27 additions and 13 deletions.
40 changes: 27 additions & 13 deletions .github/workflows/nightly.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@ on:
schedule:
- cron: '0 0 * * *'
workflow_dispatch:
inputs:
ignore_commits_force_release:
type: boolean
description: 'Ignore (new) commits and force a release'
default: false

jobs:
release:
Expand All @@ -28,37 +33,46 @@ jobs:
VERSION="$(echo $TAG | sed -e s/[^0-9]//g)"
INCREMENT="$((VERSION + 1))"
NEW_TAG="nightly-${INCREMENT}"
echo next tag '${NEW_TAG}'
echo "::set-output name=new_tag::${NEW_TAG}"
echo next tag "${NEW_TAG}"
echo "new_tag=${NEW_TAG}" >> $GITHUB_OUTPUT
echo "new_version_id=${INCREMENT}" >> $GITHUB_OUTPUT
- name: "Pull upstream"
run: |
git remote add upstream https://github.com/TeamNewPipe/NewPipe.git
git pull upstream dev
- name: "Build release apk"
run: ./gradlew assembleRelease --stacktrace -DpackageSuffix=nightly
run: >-
./gradlew assembleRelease
--stacktrace
-DpackageSuffix=nightly
-DversionNameSuffix=-${{ steps.tagger.outputs.new_version_id }}-$(date -u '+%Y%m%d%H%M')
-DversionCodeOverride=${{ steps.tagger.outputs.new_version_id }}
- name: "Check for new commits"
- name: "Checking if a release needs to be done"
run : |
if [[ "$(git log --since=1.days)" ]]; then
echo "New commits found"
echo "new_commit=true" >> $GITHUB_ENV
if [[ "${{ inputs.ignore_commits_force_release }}" == "true" ]]; then
echo "Ignoring commits - Forcing release"
echo "do_release=true" >> $GITHUB_ENV
elif [[ "$(git log --since=1.days)" ]]; then
echo "New commits found - Will do a release"
echo "do_release=true" >> $GITHUB_ENV
fi
- name: "Tag commit"
if: ${{ env.new_commit == 'true' }}
if: ${{ env.do_release == 'true' }}
run: git tag "${{ steps.tagger.outputs.new_tag }}"

- name: "Push to nightly repo"
if: ${{ env.new_commit == 'true' }}
if: ${{ env.do_release == 'true' }}
uses: ad-m/[email protected]
with:
github_token: ${{secrets.ACCESS_TOKEN}}
branch: dev

- name: "Sign release"
if: ${{ env.new_commit == 'true' }}
if: ${{ env.do_release == 'true' }}
uses: ilharp/sign-android-release@v1
id: sign_app
with:
Expand All @@ -70,14 +84,14 @@ jobs:
buildToolsVersion: 33.0.0

- name: "Rename apk"
if: ${{ env.new_commit == 'true' }}
if: ${{ env.do_release == 'true' }}
id: rename_apk
run: |
mv "${{steps.sign_app.outputs.signedFile}}" "app/build/outputs/apk/release/NewPipe_${{steps.tagger.outputs.new_tag}}.apk"
echo "::set-output name=apkFile::app/build/outputs/apk/release/NewPipe_${{steps.tagger.outputs.new_tag}}.apk"
echo "apkFile=app/build/outputs/apk/release/NewPipe_${{steps.tagger.outputs.new_tag}}.apk" >> $GITHUB_OUTPUT
- name: "Create GitHub release with APK"
if: ${{ env.new_commit == 'true' }}
if: ${{ env.do_release == 'true' }}
uses: softprops/action-gh-release@v1
id: create_release
with:
Expand Down

0 comments on commit 7018b09

Please sign in to comment.