github actions

This commit is contained in:
v7lin 2022-05-24 19:53:06 +08:00
parent fb6f88cff0
commit f62aa0ceb3
3 changed files with 56 additions and 26 deletions

View File

@ -10,16 +10,14 @@ jobs:
matrix: matrix:
os: [macos-latest] os: [macos-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-java@v2 - uses: subosito/flutter-action@v2
with:
distribution: 'temurin'
java-version: '11'
cache: 'gradle'
- uses: subosito/flutter-action@v1
with: with:
channel: 'stable' channel: 'stable'
- run: dart --version - name: Run ${{ github.repository_owner }}/clang-format@shell
run: |
brew install clang-format
- run: clang-format -style=file -i ios/Classes/*.h ios/Classes/*.m --dry-run
- run: flutter --version - run: flutter --version
- run: flutter pub get - run: flutter pub get
- run: flutter format --dry-run --set-exit-if-changed . - run: flutter format --dry-run --set-exit-if-changed .
@ -34,20 +32,20 @@ jobs:
matrix: matrix:
os: [ubuntu-latest] os: [ubuntu-latest]
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: actions/setup-java@v2 - uses: actions/setup-java@v2
with: with:
distribution: 'temurin' distribution: 'zulu'
java-version: '11' java-version: '11'
cache: 'gradle' - uses: subosito/flutter-action@v2
- uses: subosito/flutter-action@v1
with: with:
channel: 'stable' channel: 'stable'
- run: dart --version - name: Run ${{ github.repository_owner }}/install-ndk@shell
run: |
sudo echo "y" | sudo $ANDROID_HOME/tools/bin/sdkmanager "ndk;21.1.6352462"
- run: flutter --version - run: flutter --version
- run: flutter pub get - run: flutter pub get
- run: flutter format --dry-run --set-exit-if-changed . - run: flutter format --dry-run --set-exit-if-changed .
- run: flutter pub publish --dry-run - run: flutter pub publish --dry-run
- run: flutter analyze lib example/lib - run: flutter analyze lib example/lib
- run: sudo echo "y" | sudo $ANDROID_HOME/tools/bin/sdkmanager "ndk;21.1.6352462"
- run: cd example; flutter build apk --debug - run: cd example; flutter build apk --debug

View File

@ -9,10 +9,26 @@ jobs:
name: Publish name: Publish
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: sakebook/actions-flutter-pub-publisher@v1.4.0 - uses: subosito/flutter-action@v2
with: with:
credential: ${{ secrets.CREDENTIAL_JSON }} channel: 'stable'
flutter_package: true - name: Run inject credentials
skip_test: true env:
dry_run: false CREDENTIALS: ${{ secrets.CREDENTIALS_JSON }}
run: |
if [ -z $PUB_CACHE ];then
PUB_CACHE=~/.pub-cache
fi
mkdir -p $PUB_CACHE
echo $CREDENTIALS > $PUB_CACHE/credentials.json
- run: flutter --version
- run: flutter pub get
- run: flutter format --dry-run --set-exit-if-changed .
- run: echo "y" | flutter pub publish
- name: Run update credentials
env:
UPDATE_SECRETS_PAT_TOKEN: ${{ secrets.UPDATE_SECRETS_PAT_TOKEN }}
run: |
gh auth login --with-token <<< $UPDATE_SECRETS_PAT_TOKEN
gh secret set CREDENTIALS_JSON < $PUB_CACHE/credentials.json

View File

@ -7,10 +7,26 @@ jobs:
name: Publish Manually name: Publish Manually
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- uses: actions/checkout@v2 - uses: actions/checkout@v3
- uses: sakebook/actions-flutter-pub-publisher@v1.4.0 - uses: subosito/flutter-action@v2
with: with:
credential: ${{ secrets.CREDENTIAL_JSON }} channel: 'stable'
flutter_package: true - name: Run inject credentials
skip_test: true env:
dry_run: false CREDENTIALS: ${{ secrets.CREDENTIALS_JSON }}
run: |
if [ -z $PUB_CACHE ];then
PUB_CACHE=~/.pub-cache
fi
mkdir -p $PUB_CACHE
echo $CREDENTIALS > $PUB_CACHE/credentials.json
- run: flutter --version
- run: flutter pub get
- run: flutter format --dry-run --set-exit-if-changed .
- run: echo "y" | flutter pub publish
- name: Run update credentials
env:
UPDATE_SECRETS_PAT_TOKEN: ${{ secrets.UPDATE_SECRETS_PAT_TOKEN }}
run: |
gh auth login --with-token <<< $UPDATE_SECRETS_PAT_TOKEN
gh secret set CREDENTIALS_JSON < $PUB_CACHE/credentials.json