Skip to content

Commit

Permalink
chore: rewrite publish pipeline to use Melos (#344)
Browse files Browse the repository at this point in the history
  • Loading branch information
tilucasoli authored Jul 5, 2024
1 parent b147aa9 commit a2e4779
Show file tree
Hide file tree
Showing 4 changed files with 73 additions and 16 deletions.
6 changes: 4 additions & 2 deletions .github/actions/test/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -75,14 +75,16 @@ runs:
run: melos run fix
shell: bash

# Lint
- name: analyze
run: melos run analyze
run: melos run --no-select analyze
shell: bash

- name: Run custom_lint
run: melos run custom_lint_analyze
shell: bash


# Others
- name: Verify if mix_lint_test is up to date with mix_lint
run: cd scripts && ./compare_files.sh ../packages/mix_lint/lib/src/lints ../packages/mix_lint_test/test/lints
shell: bash
50 changes: 50 additions & 0 deletions .github/workflows/changelog.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Changelog

on:
workflow_dispatch:

jobs:

version:
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Install FVM
shell: bash
run: |
curl -fsSL https://fvm.app/install.sh | bash
fvm use stable --force
- uses: kuhnroyal/flutter-fvm-config-action@v2
id: fvm-config-action

- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}

- name: Flutter version
shell: bash
run: flutter --version

- name: Setup Melos
uses: bluefireteam/melos-action@v3

- name: Run melos version
run: melos run fix

- name: Run melos version
run: melos version --yes

- name: Create Pull Request
uses: peter-evans/create-pull-request@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}
commit-message: 'chore: version packages'
title: 'chore: version packages'
body: 'This PR was opened by the changelog GitHub Actions workflow'
branch: 'create-pull-request/package-versions'
12 changes: 6 additions & 6 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ name: Publish to pub.dev
on:
push:
tags:
- 'v[0-9]+.[0-9]+.[0-9]+*'
- '*'

jobs:
test:
Expand All @@ -24,9 +24,9 @@ jobs:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3

- name: Setup Melos
uses: bluefireteam/melos-action@v3

- name: 'Publish Package'
uses: k-paxian/dart-package-publisher@master
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
relativePath: "packages/mix"
run: melos run publish --no-dry-run
21 changes: 13 additions & 8 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ categories:
- packages/mix
- packages/mix_annotations
- packages/mix_generator
- packages/mix_lint
should_test:
- packages/mix
- examples/**
Expand All @@ -19,7 +20,10 @@ command:
environment:
sdk: ">=3.0.6 <4.0.0"
flutter: ">=3.10.6"

publish:
hooks:
pre: melos run brb

scripts:
brb:
description: Run build_runner for projects that have it as a dependency
Expand All @@ -37,15 +41,16 @@ scripts:
- melos exec dart fix --apply .
- melos exec --depends-on="dart_code_metrics_presets" dcm fix .
custom_lint_analyze:
steps:
- dart pub global activate custom_lint
- melos exec --depends-on="mix_lint" custom_lint
run: dart pub global activate custom_lint && melos exec --depends-on="mix_lint" custom_lint

analyze:
steps:
- melos exec --category="mix_deps" dart analyze --fatal-infos .
- melos exec --category="mix_deps" --depends-on="dart_code_metrics_presets" dcm analyze --fatal-warnings --fatal-style --fatal-performance .
- melos run custom_lint_analyze
run: |
dcm analyze --fatal-warnings --fatal-style --fatal-performance .
dart analyze --fatal-infos .
exec:
failFast: true
packageFilters:
category: "mix_deps"

verify_version_pubspec_changelog:
run: ./scripts/verify_changelogs.sh packages
Expand Down

0 comments on commit a2e4779

Please sign in to comment.