Updated permission for all CI jobs #30
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: Internal or Beta Release | |
on: | |
workflow_dispatch: | |
inputs: | |
release_type: | |
required: false | |
default: 'internal' | |
description: Please select the release type | |
type: choice | |
options: | |
- internal | |
- beta | |
amazon: | |
type: boolean | |
description: 'This is a amazon release' | |
required: false | |
default: false | |
push: | |
branches: | |
- main | |
jobs: | |
app_build: | |
name: Github, Firebase, and Sentry Release | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Enable KVM group perms | |
run: | | |
echo 'KERNEL=="kvm", GROUP="kvm", MODE="0666", OPTIONS+="static_node=kvm"' | sudo tee /etc/udev/rules.d/99-kvm4all.rules | |
sudo udevadm control --reload-rules | |
sudo udevadm trigger --name-match=kvm | |
ls /dev/kvm | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Copy CI gradle.properties | |
run: mkdir -p ~/.gradle ; cp .github/ci-gradle.properties ~/.gradle/gradle.properties | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- uses: ruby/setup-ruby@v1 | |
with: | |
ruby-version: '3.2' | |
bundler-cache: true | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v4 | |
with: | |
validate-wrappers: true | |
- name: Install GMD image for baseline profile generation | |
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager "system-images;android-33;aosp_atd;x86_64" | |
- name: Accept Android licenses | |
run: yes | "$ANDROID_HOME"/cmdline-tools/latest/bin/sdkmanager --licenses || true | |
- uses: ./.github/actions/create-release-number | |
name: 🔧 Create Release Number | |
id: rel_number | |
- uses: ./.github/actions/inflate-secrets | |
name: 🔑 Inflate Secrets | |
with: | |
keystore: ${{ secrets.KEYSTORE_FILE }} | |
google-services: ${{ secrets.GOOGLESERVICES }} | |
firebase-creds: ${{ secrets.FIREBASECREDS }} | |
- uses: ./.github/actions/create-release-notes | |
name: 🍀 Create Release Notes | |
with: | |
tag-name: ${{ steps.rel_number.outputs.version }} | |
gh-token: ${{ secrets.GITHUB_TOKEN }} | |
- name: 🍀 Build Changelog | |
id: build_changelog | |
uses: mikepenz/release-changelog-builder-action@v5 | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
- name: 🔧 Build Release | |
id: build_release | |
env: | |
KEYSTORE_PATH: ${{ secrets.KEYSTORE_PATH }} | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_FILE_PASSWORD }} | |
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }} | |
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }} | |
run: ./gradlew :app:assembleRelease | |
-Pandroid.testInstrumentationRunnerArguments.androidx.benchmark.enabledRules=BaselineProfile | |
-Pandroid.testoptions.manageddevices.emulator.gpu="swiftshader_indirect" | |
-Pandroid.experimental.testOptions.managedDevices.emulator.showKernelLogging=true | |
-Pandroid.experimental.androidTest.numManagedDeviceShards=1 | |
-Pandroid.experimental.testOptions.managedDevices.maxConcurrentDevices=1 | |
- name: ☁️ Upload APKs | |
if: steps.build_release.outcome == 'success' | |
uses: actions/upload-artifact@v4 | |
with: | |
name: APKs | |
path: '**/build/outputs/apk/**/*.apk' | |
- name: 🍀 Create Version File | |
if: github.event.inputs.release_type == 'beta' | |
shell: bash | |
env: | |
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }} | |
run: | | |
echo $VERSION_CODE > ./app/build/outputs/version_code.txt | |
- name: 🤖 Create Github Pre-Release | |
id: create_release | |
if: github.event.inputs.release_type == 'beta' | |
uses: softprops/action-gh-release@v2.0.8 | |
with: | |
tag_name: ${{ steps.rel_number.outputs.version }} | |
draft: false | |
prerelease: true | |
body_path: ./app/build/outputs/changelogGithub.md | |
files: | | |
./app/build/outputs/apk/demo/release/app-demo-release.apk | |
./app/build/outputs/apk/prod/release/app-prod-release.apk | |
./app/build/outputs/version_code.txt | |
- name: ☁️ Upload APKs on Slack | |
if: github.event.inputs.release_type == 'beta' | |
uses: MeilCli/slack-upload-file@v4 | |
with: | |
slack_token: ${{ secrets.SLACK_TOKEN }} | |
channel_id: ${{ secrets.SLACK_CHANNEL }} | |
file_path: './app/build/outputs/apk/**/*.apk' | |
file_type: 'apk' | |
initial_comment: | | |
You have released a new version of the app. | |
🍏 version: ${{ steps.rel_number.outputs.version }} | |
🤖 build: ${{ steps.rel_number.outputs.version-code }} | |
- name: 🤖 Create Sentry release | |
if: github.event.inputs.release_type == 'beta' | |
uses: getsentry/action-release@v1 | |
env: | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_RELEASE_TOKEN }} | |
SENTRY_ORG: ${{ secrets.SENTRY_ORG }} | |
SENTRY_PROJECT: ${{ secrets.SENTRY_PROJECT }} | |
with: | |
environment: production | |
version: ${{ steps.rel_number.outputs.version }} | |
version_prefix: 'v' | |
- name: ☁️ Deploy to Firebase | |
env: | |
KEYSTORE_PATH: ${{ secrets.KEYSTORE_PATH }} | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_FILE_PASSWORD }} | |
KEYSTORE_ALIAS: ${{ secrets.KEYSTORE_ALIAS }} | |
KEYSTORE_ALIAS_PASSWORD: ${{ secrets.KEYSTORE_ALIAS_PASSWORD }} | |
SENTRY_AUTH_TOKEN: ${{ secrets.SENTRY_AUTH_TOKEN }} | |
SENTRY_DSN: ${{ secrets.SENTRY_DSN }} | |
VERSION_CODE: ${{ steps.rel_number.outputs.version-code }} | |
run: ./gradlew appDistributionUploadProdRelease --no-configuration-cache | |
- name: 🤖 Prepare Amazon Listing | |
if: github.event.inputs.release_type == 'beta' && github.event.inputs.amazon == 'true' | |
run: bundle exec fastlane prep_amazon | |
env: | |
AMAZON_APPSTORE_CLIENT_ID: ${{ secrets.AMAZON_APPSTORE_CLIENT_ID }} | |
AMAZON_APPSTORE_CLIENT_SECRET: ${{ secrets.AMAZON_APPSTORE_CLIENT_SECRET }} | |
AMAZON_APPSTORE_APP_ID: ${{ secrets.AMAZON_APPSTORE_APP_ID }} | |
- name: 🍏 Update Changelog | |
id: update_changelog | |
if: steps.create_release.outcome == 'success' | |
uses: stefanzweifel/changelog-updater-action@v1 | |
with: | |
latest-version: ${{ steps.rel_number.outputs.version }} | |
release-notes: ./app/build/outputs/changelogGithub.md | |
- name: 🤖 Commit CHANGELOG.md | |
if: steps.update_changelog.outcome == 'success' | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: main | |
commit_message: 'docs: update CHANGELOG.md' | |
file_pattern: CHANGELOG.md | |
- name: Print `git status` | |
run: git status |