mirror of
https://github.com/gmeligio/flutter-docker-image.git
synced 2026-05-24 12:30:34 +00:00
157 lines
6.1 KiB
YAML
157 lines
6.1 KiB
YAML
on:
|
|
schedule:
|
|
- cron: '0 0 * * MON-FRI'
|
|
workflow_dispatch:
|
|
|
|
# Declare default permissions as read only.
|
|
permissions:
|
|
contents: read
|
|
|
|
jobs:
|
|
update_flutter_version:
|
|
permissions:
|
|
# Allow to write contents to push commits
|
|
contents: write
|
|
# Allow to write pull requests to push commits and write comments
|
|
pull-requests: write
|
|
runs-on: ubuntu-24.04
|
|
outputs:
|
|
new_version: ${{ steps.update_flutter_version.outputs.result }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
- name: Update latest Flutter version
|
|
id: update_flutter_version
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
with:
|
|
script: |
|
|
const script = require('./script/updateFlutterVersion.js')
|
|
return await script({core, fetch})
|
|
|
|
- name: Setup CUE
|
|
if: ${{ steps.update_flutter_version.outputs.result == 'true' }}
|
|
uses: cue-lang/setup-cue@a93fa358375740cd8b0078f76355512b9208acb1 # v1.0.1
|
|
|
|
- name: Validate version.json with CUE
|
|
if: ${{ steps.update_flutter_version.outputs.result == 'true' }}
|
|
run: cue vet config/version.cue -d '#FlutterVersion' config/flutter_version.json
|
|
|
|
- name: Upload artifact with the new Flutter version
|
|
if: ${{ steps.update_flutter_version.outputs.result == 'true' }}
|
|
uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4.6.2
|
|
with:
|
|
name: flutter_version.json
|
|
path: config/flutter_version.json
|
|
|
|
update_android_version:
|
|
permissions:
|
|
# Allow to write contents to push commits
|
|
contents: write
|
|
# Allow to read packages to pull the container image from GitHub Container Registry
|
|
packages: read
|
|
# Allow to write pull requests to create a pull request
|
|
pull-requests: write
|
|
needs: update_flutter_version
|
|
if: ${{ needs.update_flutter_version.outputs.new_version == 'true' }}
|
|
runs-on: ubuntu-24.04
|
|
container:
|
|
image: ghcr.io/${{ github.repository_owner }}/flutter-android:${{ vars.FLUTTER_VERSION }}
|
|
credentials:
|
|
username: ${{ github.actor }}
|
|
password: ${{ github.token }}
|
|
steps:
|
|
- name: Checkout repository
|
|
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2
|
|
|
|
# TODO: Workaround because actions/download-artifact can't overwrite existing files
|
|
# Check if this workaround can be removed after the following issues are fixed:
|
|
# https://github.com/actions/download-artifact/issues/225
|
|
# https://github.com/actions/download-artifact/issues/138
|
|
- name: Delete flutter_version.json
|
|
run: rm config/flutter_version.json
|
|
|
|
- name: Download artifact with the new Flutter version
|
|
uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4.2.1
|
|
with:
|
|
name: flutter_version.json
|
|
path: config
|
|
|
|
- name: Generate authentication token with GitHub App to trigger Actions
|
|
uses: actions/create-github-app-token@d72941d797fd3113feb6b93fd0dec494b13a2547 # v1.12.0
|
|
id: app-token
|
|
with:
|
|
app-id: ${{ secrets.VERIFIED_COMMIT_ID }}
|
|
private-key: ${{ secrets.VERIFIED_COMMIT_KEY }}
|
|
repositories: ${{ github.event.repository.name }}
|
|
owner: ${{ github.repository_owner }}
|
|
|
|
- name: Copy Flutter version into version manifest and export FLUTTER_* environment variables
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
with:
|
|
script: |
|
|
const script = require('./script/copyFlutterVersion.js')
|
|
await script({core})
|
|
|
|
- name: Update latest Fastlane version
|
|
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7.0.1
|
|
with:
|
|
script: |
|
|
const script = require('./script/updateFastlaneVersion.js')
|
|
await script({core, fetch})
|
|
|
|
- name: Setup Flutter
|
|
run: |
|
|
cd $FLUTTER_ROOT
|
|
git fetch origin ${{ env.FLUTTER_VERSION }}:${{ env.FLUTTER_VERSION }}
|
|
git switch --discard-changes ${{ env.FLUTTER_VERSION }}
|
|
|
|
# TODO: Create test app in specific folder with step id, to allow parallel execution
|
|
- name: Create test application
|
|
run: |
|
|
flutter create test_app
|
|
|
|
# TODO: Cache gradle https://github.com/gradle/gradle-build-action
|
|
- name: Update default Android platform versions in Flutter
|
|
working-directory: test_app/android
|
|
run: |
|
|
cat ../../script/updateAndroidVersions.gradle.kts >> app/build.gradle.kts
|
|
./gradlew --warning-mode all updateAndroidVersions
|
|
|
|
- name: Clean test application
|
|
run: |
|
|
rm -rf test_app
|
|
|
|
- name: Setup CUE
|
|
uses: cue-lang/setup-cue@a93fa358375740cd8b0078f76355512b9208acb1 # v1.0.1
|
|
|
|
- name: Validate version.json with CUE
|
|
run: cue vet config/version.cue -d '#Version' config/version.json
|
|
|
|
- name: Setup NodeJS
|
|
uses: actions/setup-node@cdca7365b2dadb8aad0a33bc7601856ffabcc48e # v4.3.0
|
|
with:
|
|
cache: 'npm'
|
|
cache-dependency-path: docs/src/package-lock.json
|
|
node-version-file: docs/src/package.json
|
|
|
|
- name: Update documentation
|
|
working-directory: docs/src
|
|
run: |
|
|
npm ci --prefer-offline
|
|
npm run build
|
|
|
|
- name: Create commit message variable
|
|
run: |
|
|
echo "COMMIT_MESSAGE=chore: update flutter dependencies in version.json for ${{ env.FLUTTER_VERSION }}" >> $GITHUB_ENV
|
|
|
|
# TODO: Generate changelog for the new flutter version, that will be the new tag
|
|
- name: Create pull request if there are changes
|
|
uses: peter-evans/create-pull-request@271a8d0340265f705b14b6d32b9829c1cb33d45e # v7.0.8
|
|
with:
|
|
commit-message: ${{ env.COMMIT_MESSAGE }}
|
|
branch: update-flutter-dependencies/${{ env.FLUTTER_VERSION }}
|
|
sign-commits: true
|
|
title: ${{ env.COMMIT_MESSAGE }}
|
|
token: ${{ steps.app-token.outputs.token }}
|