docs: add PUBLISHING.md #12
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Publish | |
on: | |
push: | |
branches: [main] | |
paths: | |
- CHANGELOG.md | |
- pubspec.yaml | |
jobs: | |
check-release: | |
runs-on: ubuntu-latest | |
outputs: | |
should_publish: ${{ steps.check_release.outputs.should_publish }} | |
steps: | |
- name: 📚 Git Checkout | |
uses: actions/checkout@v4 | |
- name: 🔍 Check if There is a Release Commit | |
id: check_release | |
run: | | |
# Get the latest commit message | |
latest_commit_msg=$(git log -1 --pretty=%B) | |
# Check if the commit message matches the release pattern | |
if [[ "$latest_commit_msg" =~ ^chore\(release\):\ v.* ]]; then | |
echo "should_publish=true" >> $GITHUB_OUTPUT | |
else | |
echo "should_publish=false" >> $GITHUB_OUTPUT | |
fi | |
publish: | |
needs: check-release | |
if: needs.check-release.outputs.should_publish == 'true' | |
uses: halildurmus/workflows/.github/workflows/dart_pub_publish.yml@main | |
secrets: | |
token: ${{ secrets.PAT }} |