From 8234dd364d2a643f589fe2eb141fc2e4fca741ca Mon Sep 17 00:00:00 2001 From: Tom Ha Date: Mon, 12 Oct 2026 13:36:06 +0100 Subject: [PATCH] ci: Bootstrap melos --- .github/workflows/release-prepare.yml | 31 +++++++++++++++++++++++++ .github/workflows/release-publish.yml | 26 +++++++++++++++++++++ .github/workflows/release-tag.yml | 33 +++++++++++++++++++++++++++ analysis_options.yaml | 4 ++++ example/analysis_options.yaml | 4 ++++ pubspec.yaml | 11 +++++++++ 6 files changed, 109 insertions(+) create mode 100644 .github/workflows/release-prepare.yml create mode 100644 .github/workflows/release-publish.yml create mode 100644 .github/workflows/release-tag.yml diff --git a/.github/workflows/release-prepare.yml b/.github/workflows/release-prepare.yml new file mode 100644 index 0000000..1124826 --- /dev/null +++ b/.github/workflows/release-prepare.yml @@ -0,0 +1,31 @@ +name: Prepare release +on: + push: + branches: [develop] + +jobs: + prepare-release: + name: Prepare release + permissions: + contents: write + pull-requests: write + runs-on: ubuntu-latest + if: "!contains(github.event.head_commit.message, 'chore(release)')" + steps: + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 #v3.1.1 + with: + app-id: ${{ secrets.MELOS_APP_ID }} + private-key: ${{ secrets.MELOS_APP_PRIVATE_KEY }} + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + token: ${{ steps.generate-token.outputs.token }} + - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 + - uses: bluefireteam/melos-action@705015c3d2bc4ab94201ac24accb2bbe070cf533 # v3.6.0 + with: + run-versioning: true + publish-dry-run: true + create-pr: true + token: ${{ steps.generate-token.outputs.token }} diff --git a/.github/workflows/release-publish.yml b/.github/workflows/release-publish.yml new file mode 100644 index 0000000..a87ceba --- /dev/null +++ b/.github/workflows/release-publish.yml @@ -0,0 +1,26 @@ +name: Publish packages +on: + workflow_dispatch: + +jobs: + publish-packages: + name: Publish packages + permissions: + id-token: write # Required for authentication using OIDC + runs-on: [ ubuntu-latest ] + steps: + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 #v3.1.1 + with: + app-id: ${{ secrets.MELOS_APP_ID }} + private-key: ${{ secrets.MELOS_APP_PRIVATE_KEY }} + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + token: ${{ steps.generate-token.outputs.token }} + - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 + - uses: bluefireteam/melos-action@705015c3d2bc4ab94201ac24accb2bbe070cf533 # v3.6.0 + with: + publish: true + environment: pub.dev \ No newline at end of file diff --git a/.github/workflows/release-tag.yml b/.github/workflows/release-tag.yml new file mode 100644 index 0000000..312178b --- /dev/null +++ b/.github/workflows/release-tag.yml @@ -0,0 +1,33 @@ +name: Tag and start release +on: + push: + branches: [develop] + workflow_dispatch: + +jobs: + publish-packages: + name: Create tags for release + runs-on: [ ubuntu-latest ] + if: contains(github.event.head_commit.message, 'chore(release)') + steps: + - name: Generate token + id: generate-token + uses: actions/create-github-app-token@1b10c78c7865c340bc4f6099eb2f838309f1e8c3 #v3.1.1 + with: + app-id: ${{ secrets.MELOS_APP_ID }} + private-key: ${{ secrets.MELOS_APP_PRIVATE_KEY }} + - uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 + with: + fetch-depth: 0 + token: ${{ steps.generate-token.outputs.token }} + - uses: dart-lang/setup-dart@65eb853c7ba17dde3be364c3d2858773e7144260 # v1.7.2 + - uses: bluefireteam/melos-action@705015c3d2bc4ab94201ac24accb2bbe070cf533 # v3.6.0 + with: + tag: true + token: ${{ steps.generate-token.outputs.token }} + - run: | + melos exec -c 1 --no-published --no-private --order-dependents -- \ + gh workflow run release-publish.yml \ + --ref \$MELOS_PACKAGE_NAME-v\$MELOS_PACKAGE_VERSION + env: + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} \ No newline at end of file diff --git a/analysis_options.yaml b/analysis_options.yaml index 76c87cd..534f26d 100644 --- a/analysis_options.yaml +++ b/analysis_options.yaml @@ -3,6 +3,10 @@ analyzer: - build/** - android/** - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml # Additional information about this file can be found at diff --git a/example/analysis_options.yaml b/example/analysis_options.yaml index 0d87f43..bf8d421 100644 --- a/example/analysis_options.yaml +++ b/example/analysis_options.yaml @@ -12,6 +12,10 @@ analyzer: - build/** - android/** - ios/** + - web/** + - windows/** + - macos/** + - linux/** include: package:flutter_lints/flutter.yaml linter: diff --git a/pubspec.yaml b/pubspec.yaml index 55eef88..903ae55 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -19,6 +19,7 @@ dev_dependencies: flutter_test: sdk: flutter flutter_lints: ^5.0.0 + melos: ^8.9.0 flutter: plugin: @@ -28,3 +29,13 @@ flutter: pluginClass: SecurityToolkitPlugin ios: pluginClass: SecurityToolkitPlugin + +melos: + useRootAsPackage: true + command: + version: + branch: develop + message: | + {new_package_versions} + includeScopes: false + workspaceChangelog: false \ No newline at end of file