Skip to content

+breaking: Update dependencies and docs #14

+breaking: Update dependencies and docs

+breaking: Update dependencies and docs #14

Workflow file for this run

##.title
## ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
##
## Dart/Flutter (DF) Packages by DevCetra.com & contributors. The use of this
## source code is governed by an MIT-style license described in the LICENSE
## file located in this project's root directory.
##
## See: https://opensource.org/license/mit
##
## ▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓
##.title~
name: Prepare version
## -----------------------------------------------------------------------------
on:
push:
branches:
- main
## -----------------------------------------------------------------------------
jobs:
prepare:
runs-on: ubuntu-latest
steps:
# Checkout the code from the repository
- name: Checkout code
uses: actions/checkout@v3
# Get the latest commit message
- name: Get commit messages
id: get_commits
run: |
COMMIT_MESSAGES=$(git log --format=%B -n 1 HEAD)
echo "::set-output name=COMMIT_MESSAGES::${COMMIT_MESSAGES}"
# Check if the commit message starts with '+'
- name: Check commit message
id: check_message
run: |
if echo "${{ steps.get_commits.outputs.COMMIT_MESSAGES }}" | grep -q "^+"; then
echo "::set-output name=PROCEED::true"
else
echo "::set-output name=PROCEED::false"
fi
# Debug environment variables
- name: Debug environment variables
run: |
echo "PROCEED=${{ steps.check_message.outputs.PROCEED }}"
echo "COMMIT_MESSAGES=${{ steps.get_commits.outputs.COMMIT_MESSAGES }}"
# Set up Dart if the commit message check passed
- name: Set up Dart
if: ${{ steps.check_message.outputs.PROCEED == 'true' }}
uses: dart-lang/setup-dart@v1.2
# Format Dart code if the commit message check passed
- name: Format Dart code
if: ${{ steps.check_message.outputs.PROCEED == 'true' }}
run: dart format .
# Apply Dart fixes if the commit message check passed
- name: Apply Dart fixes
if: ${{ steps.check_message.outputs.PROCEED == 'true' }}
run: dart fix --apply
# Extract the version from pubspec.yaml if the commit message check passed
- name: Extract version from pubspec.yaml
if: ${{ steps.check_message.outputs.PROCEED == 'true' }}
id: get_version
run: |
VERSION=$(grep "version:" pubspec.yaml | sed 's/version: //')
echo "Version extracted from pubspec.yaml: $VERSION"
echo "::set-output name=PUBSPEC_VERSION::${VERSION}"
# Update CHANGELOG.md if the commit message check passed
- name: Update CHANGELOG.md
if: ${{ steps.check_message.outputs.PROCEED == 'true' }}
run: |
RELEASE_NOTES="${{ steps.get_commits.outputs.COMMIT_MESSAGES }}"
dart run .github/scripts/update_changelog.dart "${{ steps.get_version.outputs.PUBSPEC_VERSION }}" "$RELEASE_NOTES"
# Commit and push changes if the commit message check passed
- name: Commit and push changes
if: ${{ steps.check_message.outputs.PROCEED == 'true' }}
run: |
git config user.name github-actions
git config user.email github-actions@github.com
git add .
git commit -m "Prepare version ${{ steps.get_version.outputs.PUBSPEC_VERSION }}"
git push