Skip to content

Commit

Permalink
Fix setup-java step in release GH action
Browse files Browse the repository at this point in the history
  • Loading branch information
growse committed Aug 23, 2022
1 parent f0339d6 commit bb280f3
Show file tree
Hide file tree
Showing 2 changed files with 141 additions and 139 deletions.
119 changes: 60 additions & 59 deletions .github/workflows/beta.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,62 +14,63 @@ jobs:
name: Create GH release and promote Play store internal to Beta
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body_path: ./CHANGELOG.md
release_name: ${{ github.ref }}
draft: true
prerelease: true
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Decrypt secrets
env:
GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: |
echo -n $GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS > project/app/owntracks-android-gcloud-creds.json
echo -n $KEYSTORE_BASE64 | base64 -d > project/owntracks.release.keystore.jks
- name: Build APK
run: ./gradlew clean :app:getLatestVersionCodeMinusOne assembleRelease
working-directory: project
env:
KEYSTORE_PASSPHRASE: ${{ secrets.KEYSTORE_PASSPHRASE }}
ORG_GRADLE_PROJECT_google_maps_api_key: ${{ secrets.GOOGLE_MAPS_API_KEY }}
MAKE_APK_SAME_VERSION_CODE_AS_GOOGLE_PLAY: yes
- 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.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.apk
asset_content_type: application/vnd.android.package-archive
- name: Promote play store beta from internal
run: ./gradlew promoteArtifact --from-track internal --promote-track beta --release-status completed
working-directory: project
- uses: actions/checkout@v3
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body_path: ./CHANGELOG.md
release_name: ${{ github.ref }}
draft: true
prerelease: true
- name: set up JDK 11
uses: actions/setup-java@v3
with:
distribution: "temurin"
java-version: 11
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Decrypt secrets
env:
GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: |
echo -n $GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS > project/app/owntracks-android-gcloud-creds.json
echo -n $KEYSTORE_BASE64 | base64 -d > project/owntracks.release.keystore.jks
- name: Build APK
run: ./gradlew clean :app:getLatestVersionCodeMinusOne assembleRelease
working-directory: project
env:
KEYSTORE_PASSPHRASE: ${{ secrets.KEYSTORE_PASSPHRASE }}
ORG_GRADLE_PROJECT_google_maps_api_key: ${{ secrets.GOOGLE_MAPS_API_KEY }}
MAKE_APK_SAME_VERSION_CODE_AS_GOOGLE_PLAY: yes
- 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.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.apk
asset_content_type: application/vnd.android.package-archive
- name: Promote play store beta from internal
run: ./gradlew promoteArtifact --from-track internal --promote-track beta --release-status completed
working-directory: project
161 changes: 81 additions & 80 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,83 +12,84 @@ jobs:
name: Create GH release and promote Play store beta to release
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: octokit/[email protected]
name: Find beta tags
id: get_beta_tags
with:
route: GET /repos/owntracks/android/git/matching-refs/tags/${{ github.ref }}-beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get number of matching tags
id: tagCount
env:
labels: ${{ steps.get_beta_tags.outputs.data }}
run: |
echo $labels
export LENGTH=$(echo $labels | jq '. | length')
echo $LENGTH
echo "::set-output name=beta_tag_count::$LENGTH"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body_path: ./CHANGELOG.md
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Decrypt secrets
env:
GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: |
echo -n $GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS > project/app/owntracks-android-gcloud-creds.json
echo -n $KEYSTORE_BASE64 | base64 -d > project/owntracks.release.keystore.jks
- name: Build APK
run: ./gradlew clean :app:getLatestVersionCodeMinusOne assembleRelease
working-directory: project
env:
KEYSTORE_PASSPHRASE: ${{ secrets.KEYSTORE_PASSPHRASE }}
ORG_GRADLE_PROJECT_google_maps_api_key: ${{ secrets.GOOGLE_MAPS_API_KEY }}
MAKE_APK_SAME_VERSION_CODE_AS_GOOGLE_PLAY: yes
- 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.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.apk
asset_content_type: application/vnd.android.package-archive
- name: Promote play store production from beta
run: ./gradlew promoteArtifact --from-track beta --promote-track production --release-status completed
working-directory: project
if: ${{ steps.tagCount.outputs.beta_tag_count > 0 }}
- name: Promote play store production from internal
run: ./gradlew promoteArtifact --from-track internal --promote-track production --release-status completed
working-directory: project
if: ${{ steps.tagCount.outputs.beta_tag_count == 0 }}
- uses: actions/checkout@v3
- uses: octokit/[email protected]
name: Find beta tags
id: get_beta_tags
with:
route: GET /repos/owntracks/android/git/matching-refs/tags/${{ github.ref }}-beta
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Get number of matching tags
id: tagCount
env:
labels: ${{ steps.get_beta_tags.outputs.data }}
run: |
echo $labels
export LENGTH=$(echo $labels | jq '. | length')
echo $LENGTH
echo "::set-output name=beta_tag_count::$LENGTH"
- name: Create release
id: create_release
uses: actions/create-release@v1
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
tag_name: ${{ github.ref }}
body_path: ./CHANGELOG.md
release_name: ${{ github.ref }}
draft: true
prerelease: false
- name: set up JDK 11
uses: actions/setup-java@v3
with:
java-version: 11
distribution: "temurin"
- uses: actions/cache@v3
with:
path: |
~/.gradle/caches
~/.gradle/wrapper
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Decrypt secrets
env:
GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS: ${{ secrets.GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS }}
KEYSTORE_BASE64: ${{ secrets.KEYSTORE_BASE64 }}
run: |
echo -n $GOOGLE_CLOUD_SERVICE_ACCOUNT_CREDENTIALS > project/app/owntracks-android-gcloud-creds.json
echo -n $KEYSTORE_BASE64 | base64 -d > project/owntracks.release.keystore.jks
- name: Build APK
run: ./gradlew clean :app:getLatestVersionCodeMinusOne assembleRelease
working-directory: project
env:
KEYSTORE_PASSPHRASE: ${{ secrets.KEYSTORE_PASSPHRASE }}
ORG_GRADLE_PROJECT_google_maps_api_key: ${{ secrets.GOOGLE_MAPS_API_KEY }}
MAKE_APK_SAME_VERSION_CODE_AS_GOOGLE_PLAY: yes
- 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.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.apk
asset_content_type: application/vnd.android.package-archive
- name: Promote play store production from beta
run: ./gradlew promoteArtifact --from-track beta --promote-track production --release-status completed
working-directory: project
if: ${{ steps.tagCount.outputs.beta_tag_count > 0 }}
- name: Promote play store production from internal
run: ./gradlew promoteArtifact --from-track internal --promote-track production --release-status completed
working-directory: project
if: ${{ steps.tagCount.outputs.beta_tag_count == 0 }}

0 comments on commit bb280f3

Please sign in to comment.