(imp) flutter: support Impeller #131
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: CI | |
on: | |
push: | |
branches: | |
- main | |
pull_request: | |
branches: | |
- main | |
jobs: | |
package: | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
packages: write | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up temurin-jdk-17 | |
uses: actions/setup-java@v4 | |
with: | |
distribution: temurin | |
java-version: 17 | |
- name: Setup Gradle | |
uses: gradle/actions/setup-gradle@v3 | |
- name: Set up Git Hub Pages | |
uses: actions/configure-pages@v5 | |
- name: Setup Android SDK | |
uses: android-actions/setup-android@v3 | |
with: | |
packages: ndk-bundle | |
- name: Setup Flutter SDK | |
uses: flutter-actions/setup-flutter@v3 | |
- name: Cache Gradle packages | |
uses: actions/cache@v4 | |
with: | |
path: | | |
~/.gradle/caches | |
~/.gradle/wrapper | |
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
restore-keys: gradle-${{ runner.os }} | |
- name: Inflate Keystore | |
env: | |
ANDROID_JKS: ${{ secrets.ANDROID_JKS }} | |
ANDROID_JKS_SHA256: ${{ secrets.ANDROID_JKS_SHA256 }} | |
run: | | |
JKS_FILE="$(mktemp -p "${RUNNER_TEMP}" -d)/android.jks" | |
echo -n "$ANDROID_JKS" | base64 --decode > "$JKS_FILE" | |
if [ "${ANDROID_JKS_SHA256} *-" != "$(cat $JKS_FILE | sha256sum -b)" ]; then | |
exit 1 | |
fi | |
echo "ANDROID_JKS_FILE=$JKS_FILE" >> $GITHUB_ENV | |
- name: Lint Flutter plugin | |
working-directory: flutter | |
run: | | |
dart format --line-length=120 . | |
git diff-index --quiet HEAD -- || (echo "Code is not formatted. Please run 'dart format --line-length=120 .'" && exit 1) | |
- name: Build | |
env: | |
ANDROID_JKS_PASSWORD: ${{ secrets.ANDROID_JKS_PASSWORD }} | |
run: ./gradlew assembleRelease publishToMavenLocal | |
- name: Upload lib artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: lib | |
path: lib/build/outputs/aar/*-release.aar | |
- name: Build Flutter example | |
working-directory: flutter/example | |
env: | |
ANDROID_JKS_PASSWORD: ${{ secrets.ANDROID_JKS_PASSWORD }} | |
run: flutter build apk | |
- name: Upload Flutter example artifacts | |
uses: actions/upload-artifact@v4 | |
with: | |
name: flutter-example | |
path: flutter/example/build/app/outputs/flutter-apk/*-release.apk | |
- name: Build docs | |
run: | | |
sudo apt-get install -y pandoc | |
mkdir -p build/gh-pages | |
pandoc \ | |
-f gfm -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua -H gh-pages/header.html \ | |
-o build/gh-pages/index.html gh-pages/metadata.md README.md | |
mkdir -p build/gh-pages/upstreams | |
pandoc \ | |
-f gfm -t html5 -s --shift-heading-level-by=-1 --lua-filter=gh-pages/filter.lua -H gh-pages/header.html \ | |
-o build/gh-pages/upstreams/index.html gh-pages/metadata.md upstreams/README.md | |
- name: Upload GitHub Pages artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: build/gh-pages | |
- name: Publish artifacts | |
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
env: | |
ANDROID_JKS_PASSWORD: ${{ secrets.ANDROID_JKS_PASSWORD }} | |
GPG_PRIVATE_KEY: ${{ secrets.GPG_PRIVATE_KEY }} | |
GPG_PASSPHRASE: ${{ secrets.GPG_PASSPHRASE }} | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
OSSRH_USERNAME: ${{ secrets.OSSRH_USERNAME }} | |
OSSRH_TOKEN: ${{ secrets.OSSRH_TOKEN }} | |
run: ./gradlew publish -Puvccamera.version=${{ github.ref_name }}-SNAPSHOT | |
publish-github-pages: | |
if: ${{ github.event_name == 'push' && github.ref_name == 'main' }} | |
runs-on: ubuntu-latest | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
needs: | |
- package | |
environment: | |
name: github-pages | |
url: ${{ steps.publish-github-pages.outputs.page_url }} | |
steps: | |
- name: Set up Git Hub Pages | |
uses: actions/configure-pages@v5 | |
- name: Publish GitHub Pages | |
id: publish-github-pages | |
uses: actions/deploy-pages@v4 |