-
Notifications
You must be signed in to change notification settings - Fork 4
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #19 from litetex/better-versioning
Improve versioning of built APK
- Loading branch information
Showing
1 changed file
with
27 additions
and
13 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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: | ||
|
@@ -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: | ||
|
@@ -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: | ||
|