fix(ci): wrong format used in destination #23
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: Build and Release | |
on: | |
push: | |
branches: | |
- master | |
workflow_dispatch: | |
permissions: | |
contents: write | |
packages: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v2 | |
with: | |
distribution: "zulu" | |
java-version: "17" | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: ${{ runner.os }}-gradle- | |
- name: Decode and Set Up google-services.json | |
run: | | |
echo "${{ secrets.GOOGLE_SERVICE_BASE64_ENCODED }}" | base64 -d > app/google-services.json | |
- name: Decode and Set Up Keystore | |
run: | | |
echo "${{ secrets.KEYSTORE_BASE64_ENCODED }}" | base64 -d > keystore.jks | |
- name: Setup keystore.properties | |
run: | | |
echo "store.file=../keystore.jks" >> keystore.properties | |
echo "store.password=${{ secrets.KEYSTORE_PASSWORD }}" >> keystore.properties | |
echo "key.alias=tutortoise" >> keystore.properties | |
echo "key.password=${{ secrets.KEY_PASSWORD }}" >> keystore.properties | |
- name: Setup local.properties | |
run: | | |
echo "base.url=${{ secrets.BASE_URL }}" >> local.properties | |
echo "google.oauth.client.id=${{ secrets.GOOGLE_OAUTH_CLIENT_ID }}" >> local.properties | |
- name: Build Release APK | |
run: ./gradlew assembleRelease | |
env: | |
CI: true | |
# - name: Determine Version Name | |
# id: determine_version | |
# run: | | |
# if [ -z "$VERSION_NAME" ]; then | |
# # Fetch the latest tag | |
# VERSION_NAME=$(git describe --tags --abbrev=0 || echo "v1.0.$(date +'%y%m%d')") | |
# fi | |
# echo "::set-output name=version_name::$VERSION_NAME" | |
# | |
# - name: Delete Existing Release | |
# if: always() | |
# run: | | |
# gh release delete ${{ steps.determine_version.outputs.version_name }} -y || true | |
# gh release delete-tag ${{ steps.determine_version.outputs.version_name }} || true | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# | |
# - name: Create Release | |
# id: create_release | |
# uses: actions/create-release@v1 | |
# env: | |
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
# with: | |
# tag_name: ${{ steps.determine_version.outputs.version_name }} | |
# release_name: ${{ steps.determine_version.outputs.version_name }}.${{ github.run_id }} | |
# draft: false | |
# prerelease: false | |
- uses: 'google-github-actions/auth@v2' | |
with: | |
credentials_json: '${{ secrets.GOOGLE_CREDENTIALS }}' | |
- name: Upload APK to Google Cloud Storage | |
id: 'upload-apk' | |
uses: 'google-github-actions/upload-cloud-storage@v2' | |
with: | |
path: 'app/build/outputs/apk/release/app-release.apk' | |
destination: '${{ secrets.GCS_DESTINATION }}' |