diff --git a/.github/CODEOWNERS b/.github/CODEOWNERS new file mode 100644 index 0000000..d3e6442 --- /dev/null +++ b/.github/CODEOWNERS @@ -0,0 +1,2 @@ +# Every change needs review from the repository owner. +* @JanMichaelPeter diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..b7d8686 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,46 @@ +name: Publish to pub.dev + +# Runs when a version tag like v0.1.0 is pushed. The job waits for approval +# in the pub.dev environment, and pub.dev only accepts uploads from this +# repository's tags through that environment. +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+*' + +concurrency: + group: publish + cancel-in-progress: false + +env: + FLUTTER_VERSION: 3.38.1 + +jobs: + publish: + name: Publish + runs-on: ubuntu-latest + environment: pub.dev + permissions: + contents: read + id-token: write # pub.dev authenticates the upload with a GitHub OIDC token + steps: + - uses: actions/checkout@v4 + # Sets up the OIDC credentials that `flutter pub publish` uses. + - uses: dart-lang/setup-dart@v1 + - uses: subosito/flutter-action@v2 + with: + channel: stable + flutter-version: ${{ env.FLUTTER_VERSION }} + cache: true + - name: Check tag matches pubspec version + run: | + VERSION=$(sed -n 's/^version: *//p' pubspec.yaml) + if [ "v$VERSION" != "$GITHUB_REF_NAME" ]; then + echo "::error::Tag $GITHUB_REF_NAME does not match pubspec.yaml version $VERSION" + exit 1 + fi + - run: flutter pub get + - run: flutter analyze + - run: flutter test + - run: flutter pub publish --dry-run + - run: flutter pub publish --force diff --git a/pubspec.yaml b/pubspec.yaml index c517374..182d50a 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -11,6 +11,7 @@ environment: dependencies: flutter: sdk: flutter + meta: ^1.17.0 plugin_platform_interface: ^2.0.2 dev_dependencies: @@ -27,3 +28,5 @@ flutter: pluginClass: WindowPlacementPlugin ios: pluginClass: WindowPlacementPlugin + config: + enable-swift-package-manager: true