Builds a patch and uploads to shorebird #88
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-patch-android | |
run-name: Builds a patch and uploads to shorebird | |
permissions: | |
contents: write | |
packages: write | |
deployments: write | |
issues: write | |
pull-requests: write | |
repository-projects: write | |
security-events: write | |
statuses: write | |
on: | |
push: | |
branches: | |
- master | |
jobs: | |
check_changes: | |
outputs: | |
run_build: ${{ steps.verify-changed-files.outputs.any_changed }} | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Verify Changed files | |
uses: tj-actions/changed-files@v42 | |
id: verify-changed-files | |
with: | |
files: | | |
.github/workflows/build-patch.yml | |
pubspec.yaml | |
pubspec.lock | |
l10n.yaml | |
lib/** | |
android/** | |
build: | |
runs-on: ubuntu-latest | |
needs: check_changes | |
if: needs.check_changes.outputs.run_build == 'true' | |
steps: | |
- uses: actions/checkout@v3 | |
with: | |
fetch-depth: 0 | |
- uses: actions/setup-java@v2 | |
with: | |
distribution: 'zulu' | |
java-version: '11' | |
- uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
cache: true | |
cache-key: 'flutter-:os:-:channel:-:version:' # optional, change this to force refresh cache | |
architecture: x64 | |
- name: 🐦 Setup Shorebird | |
uses: shorebirdtech/setup-shorebird@v0 | |
- name: Create the Keystore | |
env: | |
KEYSTORE_B64: ${{ secrets.KEYSTORE_B64 }} | |
run: | | |
# import keystore from secrets | |
echo $KEYSTORE_B64 | base64 -d > $RUNNER_TEMP/keystore.jks | |
- name: Create key.properties | |
env: | |
KEYSTORE_PASSWORD: ${{ secrets.KEYSTORE_PASS }} | |
KEY_ALIAS: ${{ secrets.KEYSTORE_ALIAS }} | |
KEY_PASSWORD: ${{ secrets.KEY_PASS }} | |
run: | | |
echo -e "storePassword=$KEYSTORE_PASSWORD\nkeyPassword=$KEY_PASSWORD\nkeyAlias=$KEY_ALIAS\nstoreFile=$RUNNER_TEMP/keystore.jks" > android/key.properties | |
- name: 'Get Previous tag' | |
id: previoustag | |
uses: "WyriHaximus/github-action-get-previous-tag@v1" | |
with: | |
fallback: 1.0.0 | |
- name: Extract version from tag | |
uses: damienaicheh/[email protected] | |
- run: flutter pub get | |
- run: flutter gen-l10n | |
- name: 🚀 Shorebird Patch | |
run: shorebird patch android --force '--' --dart-define=BVS="Patch ${{ steps.previoustag.outputs.tag }}+${{ env.NUMBER_OF_COMMITS_SINCE_TAG }} ShoreBird" | |
env: | |
SHOREBIRD_TOKEN: ${{ secrets.SHOREBIRD_TOKEN }} |