Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
74 changes: 45 additions & 29 deletions .github/workflows/build-deploy.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,9 @@

on:
workflow_dispatch:
inputs:
publish:
description: Publish flutter package to pub.dev
type: boolean
default: false
required: true
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

permissions: {}

Expand Down Expand Up @@ -36,12 +33,12 @@
with:
persist-credentials: false

- name: Install Flutter 🎯
- name: Install Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
with:
channel: stable

- name: Install dependencies 📚
- name: Install dependencies
run: flutter pub get

- name: Read package version
Expand All @@ -51,19 +48,19 @@
echo "version=$version" >> "$GITHUB_OUTPUT"
echo "Resolved version: v$version"

- name: Verify package (dry run)
- name: Verify package
run: dart pub publish --dry-run

publish:
name: Publish to pub.dev
needs: validate
if: ${{ inputs.publish }}
if: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }}
runs-on: ubuntu-24.04
timeout-minutes: 20
environment: "pub.dev"
environment: pub.dev
permissions:
contents: write # create tag + GitHub Release
id-token: write # pub.dev OIDC publishing
contents: write
id-token: write
steps:
- name: Harden runner
uses: step-security/harden-runner@9af89fc71515a100421586dfdb3dc9c984fbf411 # v2.19.4
Expand All @@ -77,27 +74,41 @@
fetch-depth: 0
persist-credentials: false

- name: Install Flutter 🎯
- name: Configure pub.dev publishing credentials
uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1

- name: Install Flutter
uses: subosito/flutter-action@1a449444c387b1966244ae4d4f8c696479add0b2 # v2.23.0
with:
channel: stable

- name: Install dependencies 📚
- name: Install dependencies
run: flutter pub get

- name: Publish to pub.dev 🚀
- name: Verify tag matches pubspec
run: |
expected_tag="v${{ needs.validate.outputs.version }}"

Check notice

Code scanning / zizmor

code injection via template expansion: may expand into attacker-controllable code Note

code injection via template expansion: may expand into attacker-controllable code
Comment thread
ankit-uxcam marked this conversation as resolved.
Dismissed
if [ "$GITHUB_REF_NAME" != "$expected_tag" ]; then
echo "Tag $GITHUB_REF_NAME does not match pubspec version $expected_tag"
exit 1
fi

- name: Publish to pub.dev
run: dart pub publish --force

- name: Generate changelog
id: changelog
run: |
previous_tag="$(git describe --tags --abbrev=0 2>/dev/null || echo '')"
range="HEAD"
[ -n "$previous_tag" ] && range="${previous_tag}..HEAD"
current_commit="$(git rev-list -n 1 "$GITHUB_REF_NAME")"
previous_tag="$(git describe --tags --abbrev=0 "${current_commit}^" 2>/dev/null || true)"
range="$current_commit"
if [ -n "$previous_tag" ]; then
range="${previous_tag}..${current_commit}"
fi

logs="$(git log "$range" --no-merges --pretty=format:'%s' -i \
--grep='^feat.*:' --grep='^fix.*:' \
| awk -F ':' '{ sub(/^ */, "", $2); print "- " $2 }')"
| awk -F ':' 'NF > 1 { sub(/^ */, "", $2); print "- " $2 }')"

{
echo "logs<<CHANGELOG_EOF"
Expand All @@ -106,26 +117,31 @@
} >> "$GITHUB_OUTPUT"
echo "$logs"

- name: Create tag and GitHub Release
- name: Create GitHub Release
id: release
env:
VERSION: ${{ needs.validate.outputs.version }}
BODY: ${{ steps.changelog.outputs.logs }}
GH_TOKEN: ${{ github.token }}
run: |
url="$(gh release create "v$VERSION" \
--target "$GITHUB_SHA" \
--title "v$VERSION" \
--notes "$BODY" \
--latest)"
if gh release view "$GITHUB_REF_NAME" >/dev/null 2>&1; then
url="$(gh release view "$GITHUB_REF_NAME" --json url -q .url)"
else
url="$(gh release create "$GITHUB_REF_NAME" \
--verify-tag \
--title "$GITHUB_REF_NAME" \
--notes "$BODY" \
--latest)"
fi
echo "url=$url" >> "$GITHUB_OUTPUT"

- name: Notify Slack
continue-on-error: true
uses: slackapi/slack-github-action@45a88b9581bfab2566dc881e2cd66d334e621e2c # v3.0.3
env:
PKG_VERSION: v${{ needs.validate.outputs.version }}
PKG_VERSION: ${{ github.ref_name }}
CHANGELOG: ${{ steps.changelog.outputs.logs }}
RELEASE_URL: ${{ steps.release.outputs.url }}
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
with:
webhook: ${{ secrets.SLACK_WEBHOOK_URL }}
webhook-type: incoming-webhook
Expand All @@ -136,7 +152,7 @@
- type: section
text:
type: mrkdwn
text: "<!here> UXCam Flutter Plugin *{{ env.PKG_VERSION }}* has been released. :rocket:"
text: "<!here> UXCam Flutter Plugin *{{ env.PKG_VERSION }}* has been released."
- type: section
fields:
- type: mrkdwn
Expand Down
2 changes: 1 addition & 1 deletion example/android/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ pluginManagement {
plugins {
id("dev.flutter.flutter-plugin-loader") version "1.0.0"
id("com.android.application") version "8.7.0" apply false
id("org.jetbrains.kotlin.android") version "1.8.22" apply false
id("org.jetbrains.kotlin.android") version "2.1.0" apply false
}

include(":app")
3 changes: 1 addition & 2 deletions example/ios/Podfile
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
# Uncomment this line to define a global platform for your project
# platform :ios, '13.0'
platform :ios, '13.0'

# CocoaPods analytics sends network stats synchronously affecting flutter build latency.
ENV['COCOAPODS_DISABLE_STATS'] = 'true'
Expand Down
12 changes: 6 additions & 6 deletions example/ios/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
PODS:
- Flutter (1.0.0)
- flutter_uxcam (2.7.6):
- flutter_uxcam (2.8.3):
- Flutter
- UXCam (~> 3.7.6)
- UXCam (3.7.6)
- UXCam (~> 3.8.3)
- UXCam (3.8.3)

DEPENDENCIES:
- Flutter (from `Flutter`)
Expand All @@ -21,9 +21,9 @@ EXTERNAL SOURCES:

SPEC CHECKSUMS:
Flutter: cabc95a1d2626b1b06e7179b784ebcf0c0cde467
flutter_uxcam: c38cf6c3eced71c537ff75340678d6ea8cb7164e
UXCam: 47c2b1a152b1914b3eec06b39b0c3523d71ad8ad
flutter_uxcam: edadcf35f8da6bef6962324d9e56cd7849ed1f5f
UXCam: 7cc67adb0297303376037170d2d468452422e803

PODFILE CHECKSUM: a3b6f034f0d79a209652621b979bc9d6707da7a1
PODFILE CHECKSUM: 3c41d3a6488201d7e0d12c3265a22101f620ec8e

COCOAPODS: 1.16.2
7 changes: 6 additions & 1 deletion example/pubspec.lock
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,12 @@ packages:
path: ".."
relative: true
source: path
version: "2.7.6"
version: "2.8.3"
flutter_web_plugins:
dependency: transitive
description: flutter
source: sdk
version: "0.0.0"
leak_tracker:
dependency: transitive
description:
Expand Down
11 changes: 7 additions & 4 deletions lib/src/models/uxoverlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class FlutterUXOverlay extends FlutterUXOcclusion {
Color color = Colors.red;
bool hideGestures = true;

int _colorChannel(double value) =>
(value * 255.0).round().clamp(0, 255).toInt();

@override
String get name =>
'UXOcclusionTypeOverlay'; // not used.. only to make it compatible with blur
Expand All @@ -20,10 +23,10 @@ class FlutterUXOverlay extends FlutterUXOcclusion {
@override
Map<String, dynamic>? get configuration => {
FlutterUxOverlayKeys.color: [
color.red * 255.round().clamp(0, 255),
color.green * 255.round().clamp(0, 255),
color.blue * 255.round().clamp(0, 255),
color.alpha * 255.round().clamp(0, 255)
_colorChannel(color.r),
_colorChannel(color.g),
_colorChannel(color.b),
_colorChannel(color.a)
],
FlutterUxOverlayKeys.hideGestures: hideGestures
};
Expand Down
11 changes: 7 additions & 4 deletions lib/src/uxoverlay.dart
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ class FlutterUXOverlay extends FlutterUXOcclusion {
Color color = Colors.red;
bool hideGestures = true;

int _colorChannel(double value) =>
(value * 255.0).round().clamp(0, 255).toInt();

@override
String get name =>
'UXOcclusionTypeOverlay'; // not used.. only to make it compatible with blur
Expand All @@ -20,10 +23,10 @@ class FlutterUXOverlay extends FlutterUXOcclusion {
@override
Map<String, dynamic>? get configuration => {
FlutterUxOverlayKeys.color: [
color.red,
color.green,
color.blue,
color.alpha
_colorChannel(color.r),
_colorChannel(color.g),
_colorChannel(color.b),
_colorChannel(color.a)
],
FlutterUxOverlayKeys.hideGestures: hideGestures
};
Expand Down