nightly #374
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
name: nightly | |
on: | |
schedule: | |
- cron: '0 0 * * *' | |
workflow_dispatch: | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: '0' | |
ref: 'dev' | |
token: ${{secrets.ACCESS_TOKEN}} | |
- uses: actions/setup-java@v3 | |
with: | |
distribution: 'temurin' | |
java-version: '17' | |
cache: 'gradle' | |
- name: "Determine next tag" | |
id: tagger | |
run: | | |
TAG=$(git tag --sort=-v:refname | grep nightly- | head -n 1) | |
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}" | |
- 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 | |
- name: "Check for new commits" | |
run : | | |
if [[ $(git log --since=1.days) ]]; then | |
echo "New commits found" | |
echo "new_commit=true" >> $GITHUB_ENV | |
fi | |
- name: "Tag commit" | |
if: ${{ env.new_commit == 'true' }} | |
run: git tag ${{ steps.tagger.outputs.new_tag }} | |
- name: "Push to nightly repo" | |
if: ${{ env.new_commit == 'true' }} | |
uses: ad-m/[email protected] | |
with: | |
github_token: ${{secrets.ACCESS_TOKEN}} | |
branch: dev | |
- name: "Sign release" | |
if: ${{ env.new_commit == 'true' }} | |
uses: r0adkll/sign-android-release@v1 | |
id: sign_app | |
with: | |
releaseDirectory: app/build/outputs/apk/release | |
signingKeyBase64: ${{ secrets.SIGNING_KEY }} | |
alias: ${{ secrets.ALIAS }} | |
keyStorePassword: ${{ secrets.KEY_STORE_PASSWORD }} | |
keyPassword: ${{ secrets.KEY_PASSWORD }} | |
- name: "Create GitHub release" | |
if: ${{ env.new_commit == 'true' }} | |
uses: actions/create-release@v1 | |
id: create_release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
tag_name: ${{ steps.tagger.outputs.new_tag }} | |
release_name: ${{ steps.tagger.outputs.new_tag }} | |
commitish: dev | |
- name: "Upload release APK" | |
if: ${{ env.new_commit == 'true' }} | |
uses: actions/upload-release-asset@v1 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
with: | |
upload_url: ${{ steps.create_release.outputs.upload_url }} | |
asset_path: ${{ steps.sign_app.outputs.signedReleaseFile }} | |
asset_name: NewPipe_${{steps.tagger.outputs.new_tag}}.apk | |
asset_content_type: application/zip |