Skip to content

Commit

Permalink
Add automated release publishing to CI/CD
Browse files Browse the repository at this point in the history
  • Loading branch information
javulticat committed Jan 4, 2024
1 parent c01d5b0 commit a0222dd
Show file tree
Hide file tree
Showing 2 changed files with 55 additions and 6 deletions.
48 changes: 48 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
name: CD

on:
pull_request:
push:
# tags:
# - "v?[0-9]+.[0-9]+.[0-9]+(-[0-9]+)?"

permissions:
contents: write

jobs:
publish-release:
runs-on: ubuntu-latest
env:
test_ref_name: v0.26.1
steps:
- name: Checkout code repository
uses: actions/checkout@v4
- name: Setup Java
uses: actions/setup-java@v4
with:
distribution: temurin
java-version: 17
- name: Setup Gradle
uses: gradle/gradle-build-action@v2
- name: Build release APK
run: ./gradlew assembleRelease
- name: Upload APK artifact
uses: actions/upload-artifact@v4
with:
name: app-release
path: app/build/outputs/apk/release/*.apk
- name: Get changelog
env:
changelogs_folder: fastlane/metadata/android/en-US/changelogs
run: echo "changelog=${{ github.server_url }}/${{ github.repository }}/blob/$test_ref_name/$(find $changelogs_folder -name $(ls -vr $changelogs_folder | head -1))" >> "$GITHUB_ENV"
- name: Create GitHub Release with APK
uses: ncipollo/release-action@v1
with:
draft: true
prerelease: true
allowUpdates: true
makeLatest: false
tag: $test_ref_name
name: TESTING AUTOMATED RELEASE PROCESS - NOT INTENDED FOR USE
artifacts: app/build/outputs/apk/release/*.apk
body: "This release merges latest NewPipe `$test_ref_name`.\n\nFor the complete list of changes see [CHANGELOG]($changelog)."
13 changes: 7 additions & 6 deletions app/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -42,24 +42,25 @@ android {
if (normalizedWorkingBranch.isEmpty() || workingBranch == "master" || workingBranch == "dev") {
// default values when branch name could not be determined or is master or dev
applicationIdSuffix ".debug"
resValue "string", "app_name", "NewPipe Debug"
resValue "string", "app_name", "NewPipe SponsorBlock Debug"
} else {
applicationIdSuffix ".debug." + normalizedWorkingBranch
resValue "string", "app_name", "NewPipe " + workingBranch
archivesBaseName = 'NewPipe_' + normalizedWorkingBranch
resValue "string", "app_name", "NewPipe SponsorBlock" + workingBranch
archivesBaseName = 'NewPipe_x_SponsorBlock' + normalizedWorkingBranch
}
}

release {
if (System.properties.containsKey('packageSuffix')) {
applicationIdSuffix System.getProperty('packageSuffix')
resValue "string", "app_name", "NewPipe " + System.getProperty('packageSuffix')
archivesBaseName = 'NewPipe_' + System.getProperty('packageSuffix')
resValue "string", "app_name", "NewPipe SponsorBlock" + System.getProperty('packageSuffix')
archivesBaseName = 'NewPipe_x_SponsorBlock' + System.getProperty('packageSuffix')
}
minifyEnabled true
shrinkResources false // disabled to fix F-Droid's reproducible build
proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
archivesBaseName = 'app'
archivesBaseName = "NewPipe_x_SponsorBlock_${defaultConfig.versionName}"
outputFileName = "${archivesBaseName}.apk"
}
}

Expand Down

0 comments on commit a0222dd

Please sign in to comment.