diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index b7778ff..b8ecae9 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -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: diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 513b7a3..d946fa2 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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 diff --git a/example/pubspec.yaml b/example/pubspec.yaml index ed3b5f8..030dd1f 100644 --- a/example/pubspec.yaml +++ b/example/pubspec.yaml @@ -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 diff --git a/example_ffi_plugin/example/pubspec.yaml b/example_ffi_plugin/example/pubspec.yaml index 14b9b44..643dae7 100644 --- a/example_ffi_plugin/example/pubspec.yaml +++ b/example_ffi_plugin/example/pubspec.yaml @@ -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 diff --git a/example_ffi_plugin/pubspec.yaml b/example_ffi_plugin/pubspec.yaml index f3300da..5fc0a86 100644 --- a/example_ffi_plugin/pubspec.yaml +++ b/example_ffi_plugin/pubspec.yaml @@ -21,10 +21,6 @@ dev_dependencies: sdk: flutter flutter_lints: ^5.0.0 -dependency_overrides: - wasm_ffi: - path: ../../wasm_ffi - flutter: plugin: platforms: diff --git a/pubspec.yaml b/pubspec.yaml index c7defc4..d5b9a73 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -15,10 +15,6 @@ dev_dependencies: lints: ^6.1.0 test: ^1.29.0 -dependency_overrides: - wasm_ffi: - path: ../wasm_ffi - topics: - ffi - wasm