Skip to content

.github/workflows/update_flutter_version.yml #440

.github/workflows/update_flutter_version.yml

.github/workflows/update_flutter_version.yml #440

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
steps:
- name: Checkout repository
uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4
- name: Generate authentication token with GitHub App
uses: actions/create-github-app-token@5d869da34e18e7287c1daad50e0b8ea0f506ce69 # v1
id: generate-token
with:
app-id: ${{ secrets.VERIFIED_COMMIT_ID }}
private-key: ${{ secrets.VERIFIED_COMMIT_KEY }}
- name: Update latest Flutter version
uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7
with:
script: |
const script = require('./script/updateFlutterVersion.js')
await script({core, fetch})
- name: Setup Cue for JSON validation
uses: cue-lang/setup-cue@a93fa358375740cd8b0078f76355512b9208acb1 # v1.0.1
- name: Validate version.json
run: cue vet config/flutter_version.cue config/flutter_version.json
- name: Create commit message variable
run: |
echo "COMMIT_MESSAGE=chore: update flutter version in flutter_version.json to ${{ env.FLUTTER_VERSION }}" >> $GITHUB_ENV
- name: Create pull request if there are changes
uses: peter-evans/create-pull-request@5e914681df9dc83aa4e4905692ca88beb2f9e91f # v7
with:
commit-message: ${{ env.COMMIT_MESSAGE }}
branch: update-flutter-version/${{ env.FLUTTER_VERSION }}
sign-commits: true
title: ${{ env.COMMIT_MESSAGE }}
token: ${{ steps.generate-token.outputs.token }}