name: Check for Flutter SDK Updates on: schedule: - cron: '0 8 * * *' workflow_dispatch: jobs: check-update: runs-on: ubuntu-latest steps: - name: Get latest Flutter stable version id: flutter run: | LATEST=$(curl -fsSL https://storage.googleapis.com/flutter_infra_release/releases/releases_linux.json \ | jq -r '.current_release.stable as $hash | .releases[] | select(.hash == $hash) | .version') echo "version=${LATEST}" >> $GITHUB_OUTPUT echo "Latest Flutter stable: ${LATEST}" - name: Check if release already exists id: existing run: | VERSION="${{ steps.flutter.outputs.version }}" STATUS=$(curl -s -o /dev/null -w "%{http_code}" \ "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases/tags/${VERSION}") if [ "$STATUS" = "200" ]; then echo "exists=true" >> $GITHUB_OUTPUT echo "Release ${VERSION} already exists, skipping" else echo "exists=false" >> $GITHUB_OUTPUT echo "Release ${VERSION} not found, will create" fi - name: Create release for new version if: steps.existing.outputs.exists == 'false' && steps.flutter.outputs.version != '' run: | VERSION="${{ steps.flutter.outputs.version }}" echo "Creating release for Flutter ${VERSION}" curl -fsSL -X POST \ -H "Authorization: token ${{ secrets.GITEA_TOKEN }}" \ -H "Content-Type: application/json" \ "${{ github.server_url }}/api/v1/repos/${{ github.repository }}/releases" \ -d "{ \"tag_name\": \"${VERSION}\", \"name\": \"Flutter SDK ${VERSION}\", \"body\": \"Automated release for Flutter stable ${VERSION}\", \"draft\": false, \"prerelease\": false }"