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
56 changes: 56 additions & 0 deletions .github/workflows/release_github.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: release_github

on:
push:
branches: [master]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
# Only run this job for commits that indicate a release
if: "${{ startsWith(github.event.head_commit.message, 'chore(repo): release') }}"
runs-on: ubuntu-latest

steps:
- name: 📚 Checkout branch
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: 🏷️ Extract Version Tag
id: extract_tag
shell: bash
run: |
set -euo pipefail

commit_msg="${{ github.event.head_commit.message }}"
echo "📦 Commit message: $commit_msg"

# Match vX.Y.Z or vX.Y.Z-suffix (case-insensitive)
version_regex='[vV][0-9]+\.[0-9]+\.[0-9]+(-[0-9A-Za-z.\-]+)?'

if [[ "$commit_msg" =~ $version_regex ]]; then
version="${BASH_REMATCH[0]}"
is_prerelease=$([[ $version == *-* ]] && echo true || echo false)

echo "✅ Found version tag: $version"
echo "ℹ️ Pre-release: $is_prerelease"

echo "tag=$version" >> "$GITHUB_OUTPUT"
echo "prerelease=$is_prerelease" >> "$GITHUB_OUTPUT"
else
echo "::error ::❌ No SemVer tag found in commit message."
echo "::error ::Expected something like: 'chore(repo): release v1.2.3[-beta]'"
exit 1
fi

- name: 🚀 Create GitHub Release
uses: softprops/action-gh-release@v1
with:
generate_release_notes: true
tag_name: ${{ steps.extract_tag.outputs.tag }}
prerelease: ${{ steps.extract_tag.outputs.prerelease }}
token: ${{ secrets.BOT_GITHUB_API_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/release_pub.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: release_pub

on:
release:
types: [published]

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
release:
permissions:
id-token: write # Required for authentication using OIDC
runs-on: ubuntu-latest
steps:
- name: 📚 Checkout branch
uses: actions/checkout@v4
with:
fetch-depth: 0

# Set up the Dart SDK and provision the OIDC token used for publishing.
- name: 🎯 Setup Dart
uses: dart-lang/setup-dart@v1

- name: 🐦 Install Flutter
uses: subosito/flutter-action@v2

- name: 📦 Install Tools
run: flutter pub global activate melos

- name: 🔧 Bootstrap Workspace
run: melos bootstrap --verbose

- name: 🌵 Dry Run
run: melos run lint:pub

- name: 🚀 Release to pub.dev
run: melos run release:pub
12 changes: 6 additions & 6 deletions melos.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -149,12 +149,8 @@ scripts:
- Note: you can also rely on your IDEs Dart Analysis / Issues window.

lint:pub:
run: |
melos exec -c 5 --no-private --ignore="*example*" -- \
flutter pub publish --dry-run
description: |
Run `pub publish --dry-run` in all packages.
- Note: you can also rely on your IDEs Dart Analysis / Issues window.
run: melos exec -c 1 --no-published --no-private --order-dependents -- "flutter pub publish -n"
description: Dry run `pub publish` in all packages.

generate:all:
run: melos run generate:dart && melos run generate:flutter
Expand Down Expand Up @@ -206,3 +202,7 @@ scripts:
description: Removes all the ignored files from the coverage report.
packageFilters:
dirExists: coverage

release:pub:
run: melos exec -c 1 --no-published --no-private --order-dependents -- "flutter pub publish -f"
description: Publish all packages to pub.dev.
Loading