ci: github #3
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 | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- main | |
jobs: | |
flutter: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
with: | |
fetch-depth: 0 | |
- name: Get Flutter | |
uses: subosito/flutter-action@v2 | |
with: | |
channel: 'stable' | |
- name: Setup Java | |
uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' | |
java-version: '17' | |
- name: Download dependencies | |
run: flutter pub get | |
# - name: Run tests | |
# run: | | |
# flutter test | |
- name: Compare pubspec version and git tag | |
id: pubspec_tag | |
run: | | |
PUBSPEC_VERSION=v$(grep -oP '^version:\s*\K[0-9]+\.[0-9]+\.[0-9]+' pubspec.yaml) | |
echo "Found version in pubspec.yaml: $PUBSPEC_VERSION" | |
echo "tag_name=$PUBSPEC_VERSION" >> $GITHUB_OUTPUT | |
# This step prepares a draft release with the release notes generated from the commit messages, | |
# and the tag name from the pubspec.yaml file. It will only update the release if it is a draft | |
# and has not been published yet. If the release is already published, it will not be updated and fail. | |
# Once a version is published to the app store, the release should be marked as published. | |
- name: Create or update draft release | |
uses: ncipollo/release-action@v1 | |
with: | |
name: ${{ steps.pubspec_tag.outputs.tag_name }} | |
tag: ${{ steps.pubspec_tag.outputs.tag_name }} | |
generateReleaseNotes: true | |
makeLatest: true | |
draft: true | |
allowUpdates: true | |
updateOnlyUnreleased: true | |
# - name: Configure git | |
# run: | | |
# git config --global user.name "GitHub Actions Bot" | |
# git config --global user.email "[email protected]" | |
# git fetch origin gh-pages:gh-pages | |
# | |
# - name: Compile web and put in gh-pages branch | |
# run: dart run peanut | |
# | |
# - name: Push gh-pages | |
# run: git push origin gh-pages | |
- name: Retrieve the Android keystore and key properties | |
env: | |
UPLOAD_KEYSTORE_B64: ${{ secrets.UPLOAD_KEYSTORE_B64 }} | |
KEY_PROPERTIES: ${{ secrets.KEY_PROPERTIES }} | |
run: | | |
echo "$UPLOAD_KEYSTORE_B64" | base64 --decode > android/keystore.jks | |
echo "$KEY_PROPERTIES" > android/key.properties | |
- name: Compile Android app | |
run: flutter build appbundle --build-number ${{ github.run_number }} | |
- name: Upload Android app to Play Store | |
uses: r0adkll/upload-google-play@v1 | |
with: | |
serviceAccountJsonPlainText: ${{ secrets.SERVICE_ACCOUNT_JSON }} | |
packageName: com.sealambda.artificialstupidity | |
releaseFiles: build/app/outputs/bundle/release/app-release.aab | |
track: internal | |
status: completed | |
mappingFile: build/app/outputs/mapping/release/mapping.txt | |
debugSymbols: build/app/intermediates/merged_native_libs/release/mergeReleaseNativeLibs/out/lib |