From 0f82df2bda9be3a37e8dd9bffb1ac73b6c977670 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Sun, 27 Oct 2024 18:13:20 +0100 Subject: [PATCH 1/4] Improve versioning of built APK Include current version id/number inside version name and code for better identification --- .github/workflows/nightly.yml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 9d0d6546e..46ab100d5 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -30,6 +30,7 @@ jobs: NEW_TAG="nightly-${INCREMENT}" echo next tag '${NEW_TAG}' echo "::set-output name=new_tag::${NEW_TAG}" + echo "::set-output name=new_version_id::${INCREMENT}" - name: "Pull upstream" run: | @@ -37,7 +38,12 @@ jobs: 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" run : | From b564f84425b6750930ce365ee597a8e86b64e435 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Mon, 28 Oct 2024 21:55:02 +0100 Subject: [PATCH 2/4] Next tag is not printed when in ``'`` --- .github/workflows/nightly.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 46ab100d5..24c322014 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -28,7 +28,7 @@ jobs: VERSION="$(echo $TAG | sed -e s/[^0-9]//g)" INCREMENT="$((VERSION + 1))" NEW_TAG="nightly-${INCREMENT}" - echo next tag '${NEW_TAG}' + echo next tag "${NEW_TAG}" echo "::set-output name=new_tag::${NEW_TAG}" echo "::set-output name=new_version_id::${INCREMENT}" From a51f46a3176012acf20c3c30c7470c5fa1ceee6d Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:03:49 +0100 Subject: [PATCH 3/4] Update set-output to non depreacted syntax The `set-output` command is deprecated and will be disabled soon. Please upgrade to using Environment Files https://github.blog/changelog/2022-10-11-github-actions-deprecating-save-state-and-set-output-commands/ --- .github/workflows/nightly.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 24c322014..59c1045a8 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -29,8 +29,8 @@ jobs: INCREMENT="$((VERSION + 1))" NEW_TAG="nightly-${INCREMENT}" echo next tag "${NEW_TAG}" - echo "::set-output name=new_tag::${NEW_TAG}" - echo "::set-output name=new_version_id::${INCREMENT}" + echo "new_tag=${NEW_TAG}" >> $GITHUB_OUTPUT + echo "new_version_id=${INCREMENT}" >> $GITHUB_OUTPUT - name: "Pull upstream" run: | @@ -80,7 +80,7 @@ jobs: 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' }} From 90924cc9b2a01e682e5b9b83729e5483f41c7b43 Mon Sep 17 00:00:00 2001 From: litetex <40789489+litetex@users.noreply.github.com> Date: Mon, 28 Oct 2024 22:05:33 +0100 Subject: [PATCH 4/4] Add option to manually force a release even when there are no new commits --- .github/workflows/nightly.yml | 26 +++++++++++++++++--------- 1 file changed, 17 insertions(+), 9 deletions(-) diff --git a/.github/workflows/nightly.yml b/.github/workflows/nightly.yml index 59c1045a8..fb5bf2cf7 100644 --- a/.github/workflows/nightly.yml +++ b/.github/workflows/nightly.yml @@ -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: @@ -45,26 +50,29 @@ jobs: -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/github-push-action@v0.6.0 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: @@ -76,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 "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: