Skip to content

Commit

Permalink
debug release GHA
Browse files Browse the repository at this point in the history
  • Loading branch information
growse committed Jul 16, 2024
1 parent c10d94f commit d4d18f1
Showing 1 changed file with 87 additions and 86 deletions.
173 changes: 87 additions & 86 deletions .github/workflows/release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,9 +26,10 @@ jobs:
name: Find beta tags if this is a prod release
id: get_beta_tags
with:
route: GET /repos/owntracks/android/git/matching-refs/tags/${{ github.ref }}-beta
route: GET /repos/owntracks/android/git/matching-refs/tags/v2.5.0-beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- run: "echo beta tags: '${{ steps.get_beta_tags.outputs.data }}'"
- name: Get number of matching tags
id: tagCount
env:
Expand All @@ -39,99 +40,99 @@ jobs:
echo "${LENGTH}"
echo "name=beta_tag_count::$LENGTH" >> "${GITHUB_OUTPUT}"
- name: set up JDK 17
uses: actions/setup-java@v4
with:
java-version: 17
distribution: "temurin"
# - name: set up JDK 17
# uses: actions/setup-java@v4
# with:
# java-version: 17
# distribution: "temurin"

- name: Set up Python
uses: actions/setup-python@v5
# - name: Set up Python
# uses: actions/setup-python@v5

- name: Install python dependencies
run: |
python -m pip install --upgrade pip
pip install -r .github/google-play-api/requirements.txt
# - name: Install python dependencies
# run: |
# python -m pip install --upgrade pip
# pip install -r .github/google-play-api/requirements.txt

- name: Get current version code from internal track
if: ${{ contains(github.ref, 'beta') || steps.tagCount.outputs.beta_tag_count == 0 }}
env:
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
run: |
echo VERSION_CODE="$(python .github/google-play-api/google-play-api.py internal)" >> "${GITHUB_ENV}"
# - name: Get current version code from internal track
# if: ${{ contains(github.ref, 'beta') || steps.tagCount.outputs.beta_tag_count == 0 }}
# env:
# ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
# run: |
# echo VERSION_CODE="$(python .github/google-play-api/google-play-api.py internal)" >> "${GITHUB_ENV}"

- name: Get current version code from beta track
if: ${{ !contains(github.ref, 'beta') && steps.tagCount.outputs.beta_tag_count >= 0 }}
env:
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
run: |
echo VERSION_CODE="$(python .github/google-play-api/google-play-api.py beta)" >> "${GITHUB_ENV}"
# - name: Get current version code from beta track
# if: ${{ !contains(github.ref, 'beta') && steps.tagCount.outputs.beta_tag_count >= 0 }}
# env:
# ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
# run: |
# echo VERSION_CODE="$(python .github/google-play-api/google-play-api.py beta)" >> "${GITHUB_ENV}"

- name: Create keystore
run: |
echo -n "${KEYSTORE_BASE64}" | base64 -d > project/owntracks.release.keystore.jks
env:
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
# - name: Create keystore
# run: |
# echo -n "${KEYSTORE_BASE64}" | base64 -d > project/owntracks.release.keystore.jks
# env:
# KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}

- name: Build release APKs
uses: gradle/actions/setup-gradle@v3
env:
KEYSTORE_PASSPHRASE: ${{ secrets.KEYSTORE_PASSPHRASE }}
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
with:
build-root-directory: project
cache-encryption-key: ${{ secrets.GradleEncryptionKey }}
arguments: |
assembleRelease --stacktrace --scan
# - name: Build release APKs
# uses: gradle/actions/setup-gradle@v3
# env:
# KEYSTORE_PASSPHRASE: ${{ secrets.KEYSTORE_PASSPHRASE }}
# ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
# with:
# build-root-directory: project
# cache-encryption-key: ${{ secrets.GradleEncryptionKey }}
# arguments: |
# assembleRelease --stacktrace --scan

- name: Create release
id: create_release
uses: softprops/action-gh-release@v2
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body_path: ./CHANGELOG.md
name: ${{ github.ref }}
draft: true
prerelease: ${{ contains(github.ref, 'beta') }}
# - name: Create release
# id: create_release
# uses: softprops/action-gh-release@v2
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# tag_name: ${{ github.ref }}
# body_path: ./CHANGELOG.md
# name: ${{ github.ref }}
# draft: true
# prerelease: ${{ contains(github.ref, 'beta') }}

- name: Upload GMS Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./project/app/build/outputs/apk/gms/release/app-gms-release.apk
asset_name: owntracks-release-gms-${{ env.VERSION_CODE }}.apk
asset_content_type: application/vnd.android.package-archive
- name: Upload OSS Release Asset
uses: actions/upload-release-asset@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
asset_path: ./project/app/build/outputs/apk/oss/release/app-oss-release.apk
asset_name: owntracks-release-oss-${{ env.VERSION_CODE }}.apk
asset_content_type: application/vnd.android.package-archive
# - name: Upload GMS Release Asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./project/app/build/outputs/apk/gms/release/app-gms-release.apk
# asset_name: owntracks-release-gms-${{ env.VERSION_CODE }}.apk
# asset_content_type: application/vnd.android.package-archive
# - name: Upload OSS Release Asset
# uses: actions/upload-release-asset@v1
# env:
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
# with:
# upload_url: ${{ steps.create_release.outputs.upload_url }} # This pulls from the CREATE RELEASE step above, referencing it's ID to get its outputs object, which include a `upload_url`. See this blog post for more info: https://jasonet.co/posts/new-features-of-github-actions/#passing-data-to-future-steps
# asset_path: ./project/app/build/outputs/apk/oss/release/app-oss-release.apk
# asset_name: owntracks-release-oss-${{ env.VERSION_CODE }}.apk
# asset_content_type: application/vnd.android.package-archive

- name: Promote play store beta from internal
run: ./gradlew promoteGmsReleaseArtifact --from-track internal --promote-track beta --release-status completed
working-directory: project
if: ${{ contains(github.ref, 'beta') }}
env:
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
# - name: Promote play store beta from internal
# run: ./gradlew promoteGmsReleaseArtifact --from-track internal --promote-track beta --release-status completed
# working-directory: project
# if: ${{ contains(github.ref, 'beta') }}
# env:
# ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}

- name: Promote play store production from beta
run: ./gradlew promoteArtifact --from-track beta --promote-track production --release-status inProgress -user-fraction .1
working-directory: project
if: ${{ !contains(github.ref, 'beta') && steps.tagCount.outputs.beta_tag_count > 0 }}
env:
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
# - name: Promote play store production from beta
# run: ./gradlew promoteArtifact --from-track beta --promote-track production --release-status inProgress -user-fraction .1
# working-directory: project
# if: ${{ !contains(github.ref, 'beta') && steps.tagCount.outputs.beta_tag_count > 0 }}
# env:
# ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}

- name: Promote play store production from internal
run: ./gradlew promoteArtifact --from-track internal --promote-track production --release-status inProgress -user-fraction .1
working-directory: project
if: ${{ !contains(github.ref, 'beta') && steps.tagCount.outputs.beta_tag_count == 0 }}
env:
ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
# - name: Promote play store production from internal
# run: ./gradlew promoteArtifact --from-track internal --promote-track production --release-status inProgress -user-fraction .1
# working-directory: project
# if: ${{ !contains(github.ref, 'beta') && steps.tagCount.outputs.beta_tag_count == 0 }}
# env:
# ANDROID_PUBLISHER_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}

0 comments on commit d4d18f1

Please sign in to comment.