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
13 changes: 0 additions & 13 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,6 @@ jobs:
- name: Checkout code
uses: actions/checkout@v4

- name: Checkout wasm_ffi
uses: actions/checkout@v4
with:
repository: vm75/wasm_ffi
path: wasm_ffi-temp

- name: Set up local wasm_ffi sibling
run: |
mkdir -p ../wasm_ffi
cp -r wasm_ffi-temp/* ../wasm_ffi/
rm -rf wasm_ffi-temp
sed -i 's/version: 2.3.0/version: 2.4.0/' ../wasm_ffi/pubspec.yaml || true

- name: Set up Dart
uses: dart-lang/setup-dart@v1
with:
Expand Down
87 changes: 5 additions & 82 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -1,89 +1,12 @@
name: Publish Dart Packages
name: Publish to pub.dev

on:
push:
branches:
- main
paths:
- 'pubspec.yaml'
tags:
- 'v[0-9]+.[0-9]+.[0-9]+'

jobs:
analyze-and-publish:
name: Analyze and Publish Dart Packages
runs-on: ubuntu-latest
publish:
permissions:
id-token: write
contents: read

steps:
- name: Checkout code
uses: actions/checkout@v4
with:
fetch-depth: 2

- name: Checkout wasm_ffi
uses: actions/checkout@v4
with:
repository: vm75/wasm_ffi
path: wasm_ffi-temp

- name: Set up local wasm_ffi sibling
run: |
mkdir -p ../wasm_ffi
cp -r wasm_ffi-temp/* ../wasm_ffi/
rm -rf wasm_ffi-temp
sed -i 's/version: 2.3.0/version: 2.4.0/' ../wasm_ffi/pubspec.yaml || true

- name: Set up Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable

- name: Check if version is updated
id: check-version
run: |
CURRENT_VERSION=$(awk '/^version:/{print $2; exit}' pubspec.yaml)
PREV_VERSION=$(git show HEAD~1:pubspec.yaml 2>/dev/null | awk '/^version:/{print $2; exit}' || true)

echo "Current version: $CURRENT_VERSION"
echo "Previous version: $PREV_VERSION"

if [ -z "$CURRENT_VERSION" ]; then
echo "Error: Could not determine current version from pubspec.yaml"
exit 1
fi

if [ "$CURRENT_VERSION" = "$PREV_VERSION" ]; then
echo "Version in pubspec.yaml has not changed ($CURRENT_VERSION). Skipping publish."
echo "publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi

# Check if the version is already published on pub.dev
PUB_STATUS=$(curl -s -o /dev/null -w "%{http_code}" "https://pub.dev/api/packages/universal_ffi/versions/$CURRENT_VERSION" || true)
if [ "$PUB_STATUS" = "200" ]; then
echo "Version $CURRENT_VERSION is already published on pub.dev. Skipping publish."
echo "publish=false" >> "$GITHUB_OUTPUT"
exit 0
fi

echo "Version updated from '$PREV_VERSION' to '$CURRENT_VERSION'."
echo "publish=true" >> "$GITHUB_OUTPUT"
echo "version=$CURRENT_VERSION" >> "$GITHUB_OUTPUT"

- name: Analyze universal_ffi
if: steps.check-version.outputs.publish == 'true'
run: |
dart pub get
dart analyze
dart test

- name: Publish universal_ffi
if: steps.check-version.outputs.publish == 'true'
env:
PUB_TOKEN: ${{ secrets.PUB_TOKEN }}
run: |
echo "Validating package..."
dart pub publish --dry-run
echo "Publishing universal_ffi version ${{ steps.check-version.outputs.version }} to pub.dev..."
dart pub publish --force
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
4 changes: 0 additions & 4 deletions example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,3 @@ dev_dependencies:
build_web_compilers: ^4.0.9
lints: ^4.0.0
ffigen: ^14.0.0

dependency_overrides:
wasm_ffi:
path: ../../wasm_ffi
4 changes: 0 additions & 4 deletions example_ffi_plugin/example/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,9 +19,5 @@ dev_dependencies:
sdk: flutter
flutter_lints: ^5.0.0

dependency_overrides:
wasm_ffi:
path: ../../../wasm_ffi

flutter:
uses-material-design: true
4 changes: 0 additions & 4 deletions example_ffi_plugin/pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,6 @@ dev_dependencies:
sdk: flutter
flutter_lints: ^5.0.0

dependency_overrides:
wasm_ffi:
path: ../../wasm_ffi

flutter:
plugin:
platforms:
Expand Down
4 changes: 0 additions & 4 deletions pubspec.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,10 +15,6 @@ dev_dependencies:
lints: ^6.1.0
test: ^1.29.0

dependency_overrides:
wasm_ffi:
path: ../wasm_ffi

topics:
- ffi
- wasm
Expand Down
Loading