Add automated release publishing to CI/CD #9
Workflow file for this run
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: CD | ||
on: | ||
push: | ||
# tags: | ||
# - "v?[0-9]+.[0-9]+.[0-9]+(-[0-9]?)?" | ||
jobs: | ||
publish-release: | ||
runs-on: ubuntu-latest | ||
permissions: | ||
contents: write | ||
env: | ||
tag: v0.26.1-1 | ||
upstream_tag: "${tag%%"-"*}" | ||
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: Create release notes | ||
env: | ||
changelogs_folder: fastlane/metadata/android/en-US/changelogs | ||
changelog: "${{ github.server_url }}/${{ github.repository }}/blob/$tag/$(find $changelogs_folder -name $(ls -vr $changelogs_folder | head -1))" | ||
run: | | ||
echo "release_notes=$([[ $tag =~ ^$upstream_tag(-1)?$ ]] && echo "This release merges latest NewPipe \`$upstream_tag\`.\n\nFor the complete list of changes see [CHANGELOG]($changelog).$([[ $tag != $upstream_tag ]] && echo "\n\nIf any changes specific to this fork were also made, they will be listed in the [Fork Changelog](#fork-changelog) below.\n\n### Fork Changelog")" || echo "This release only includes changes specific to this fork. Please view the [Fork Changelog](#fork-changelog) below for details.\n\n### Fork Changelog")" >> "$GITHUB_ENV" | ||
echo "generate_fork_changelog=$([[ $tag != $upstream_tag ]] && echo "true" || echo "false")" >> "$GITHUB_ENV" | ||
- name: Create GitHub Release with APK | ||
uses: ncipollo/release-action@v1 | ||
with: | ||
draft: true | ||
tag: ${{ env.upstream_tag }} | ||
name: TEST | ||
artifacts: app/build/outputs/apk/release/*.apk | ||
body: ${{ env.release_notes }} | ||
# body: "This release merges latest NewPipe `${{ env.upstream_tag }}`.\n\nFor the complete list of changes see [CHANGELOG](${{ env.changelog }})." | ||
generateReleaseNotes: ${{ env.generate_fork_changelog }} |