Update package.json #65
Workflow file for this run
This file contains hidden or 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: Release Flutter Platform | |
| on: | |
| push: | |
| tags: | |
| - "*" | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: false | |
| jobs: | |
| release: | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.get_version.outputs.version }} | |
| commit_sha: ${{ steps.commit_version.outputs.commit_sha }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PELAGORNIS }} | |
| fetch-depth: 0 | |
| - name: Setup Python | |
| uses: actions/setup-python@v4 | |
| with: | |
| python-version: "3.11" | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.19.0" | |
| channel: "stable" | |
| - name: Configure Flutter | |
| run: | | |
| flutter config --no-analytics | |
| flutter config --no-cli-animations | |
| - name: Install Python dependencies | |
| run: | | |
| python -m pip install --upgrade pip | |
| pip install -r requirements.txt | |
| - name: Get version | |
| id: get_version | |
| run: | | |
| VERSION=${GITHUB_REF#refs/tags/} | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Debug Git status before update | |
| run: | | |
| echo "Current branch:" | |
| git branch -a | |
| echo "Current commit:" | |
| git log --oneline -n 3 | |
| echo "Git status:" | |
| git status | |
| echo "Current version in pubspec.yaml:" | |
| grep "version:" flutter/pubspec.yaml || echo "No version found" | |
| - name: Update Flutter version | |
| run: | | |
| VERSION="${{ steps.get_version.outputs.version }}" | |
| echo "Updating Flutter version to: $VERSION" | |
| # 현재 버전 확인 | |
| echo "Current version in pubspec.yaml:" | |
| grep "version:" flutter/pubspec.yaml | |
| # 버전 업데이트 | |
| sed -i "s/^version:.*/version: $VERSION/" flutter/pubspec.yaml | |
| # 변경 사항 확인 | |
| echo "Updated version in pubspec.yaml:" | |
| grep "version:" flutter/pubspec.yaml | |
| # 파일 변경사항 확인 | |
| echo "File changes:" | |
| git diff flutter/pubspec.yaml | |
| echo "✅ Updated Flutter version to $VERSION" | |
| - name: Update Flutter CHANGELOG | |
| run: | | |
| VERSION="${{ steps.get_version.outputs.version }}" | |
| cat > /tmp/changelog_entry.md << EOF | |
| ## $VERSION | |
| - Updated all platform versions to $VERSION | |
| - Fixed React Native build errors and TypeScript conflicts | |
| - Improved icon generation scripts for better consistency | |
| - Enhanced package validation and publishing process | |
| - Fixed Git push conflicts in release workflows | |
| - Added concurrency controls to prevent workflow conflicts | |
| EOF | |
| cat /tmp/changelog_entry.md flutter/CHANGELOG.md > /tmp/new_changelog.md | |
| mv /tmp/new_changelog.md flutter/CHANGELOG.md | |
| rm -f /tmp/changelog_entry.md | |
| echo "✅ Updated Flutter CHANGELOG.md with version $VERSION" | |
| - name: Commit version & changelog to main | |
| id: commit_version | |
| run: | | |
| VERSION="${{ steps.get_version.outputs.version }}" | |
| git config --local user.email "action@github.com" | |
| git config --local user.name "GitHub Action" | |
| git config --local init.defaultBranch main | |
| # Ensure we're on main branch | |
| git checkout main | |
| git add flutter/pubspec.yaml flutter/CHANGELOG.md | |
| # 변경사항이 있는지 확인 | |
| if git diff --staged --quiet; then | |
| echo "No changes to commit" | |
| echo "commit_sha=$(git rev-parse HEAD)" >> $GITHUB_OUTPUT | |
| else | |
| git commit -m "chore(flutter): bump version to $VERSION | |
| - Update flutter/pubspec.yaml version field | |
| - Update flutter/CHANGELOG.md with version $VERSION notes | |
| - Triggered by tag: ${{ github.ref }} | |
| - Workflow: ${{ github.workflow }} | |
| - Commit: ${{ github.sha }}" | |
| # Try to push, if fails, pull and retry | |
| for i in {1..3}; do | |
| if git push origin HEAD:main; then | |
| echo "✅ Successfully pushed version changes" | |
| break | |
| else | |
| echo "Push failed, attempt $i/3. Pulling latest changes..." | |
| git pull origin main --rebase | |
| sleep 2 | |
| fi | |
| done | |
| # Get the new commit SHA | |
| COMMIT_SHA=$(git rev-parse HEAD) | |
| echo "commit_sha=$COMMIT_SHA" >> $GITHUB_OUTPUT | |
| echo "✅ Committed version bump to main. New commit: $COMMIT_SHA" | |
| fi | |
| - name: Build Flutter platform | |
| run: | | |
| python3 scripts/generate_flutter_dart.py | |
| - name: Get Flutter dependencies | |
| run: | | |
| cd flutter | |
| flutter pub get | |
| cd example | |
| flutter pub get | |
| - name: Create Flutter Release | |
| if: startsWith(github.ref, 'refs/tags/') | |
| uses: softprops/action-gh-release@v2 | |
| with: | |
| tag_name: ${{ steps.get_version.outputs.version }} | |
| body: | | |
| ## 🎉 Flutter Platform Release ${{ steps.get_version.outputs.version }} | |
| ### 📦 Installation | |
| ```yaml | |
| dependencies: | |
| refineui_system_icons: ^${{ steps.get_version.outputs.version }} | |
| ``` | |
| ### 🦋 Features | |
| - Flutter-optimized components | |
| - Material Design compatible | |
| - Cross-platform consistency | |
| - 434+ icons with multiple sizes and styles | |
| - High-performance rendering | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.PELAGORNIS }} | |
| publish: | |
| needs: release | |
| permissions: | |
| id-token: write # Required for authentication using OIDC | |
| contents: read | |
| runs-on: ubuntu-latest | |
| environment: pub-dev | |
| steps: | |
| - name: Checkout updated code | |
| uses: actions/checkout@v4 | |
| with: | |
| token: ${{ secrets.PELAGORNIS }} | |
| fetch-depth: 0 | |
| # 업데이트된 커밋을 가져오기 위해 ref 지정 | |
| ref: ${{ needs.release.outputs.commit_sha || 'main' }} | |
| - name: Setup Dart | |
| uses: dart-lang/setup-dart@v1 | |
| - name: Setup Flutter | |
| uses: subosito/flutter-action@v2 | |
| with: | |
| flutter-version: "3.19.0" | |
| channel: "stable" | |
| - name: Debug version before publish | |
| run: | | |
| echo "Expected version: ${{ needs.release.outputs.version }}" | |
| echo "Current version in pubspec.yaml:" | |
| grep "version:" flutter/pubspec.yaml | |
| echo "Current commit:" | |
| git log --oneline -n 1 | |
| echo "Git status:" | |
| git status | |
| - name: Clear Flutter cache | |
| run: | | |
| flutter pub cache clean | |
| - name: Install dependencies | |
| run: | | |
| cd flutter | |
| flutter pub get | |
| - name: Validate pubspec version | |
| run: | | |
| cd flutter | |
| EXPECTED_VERSION="${{ needs.release.outputs.version }}" | |
| CURRENT_VERSION=$(grep "^version:" pubspec.yaml | sed 's/version: *//') | |
| echo "Expected version: $EXPECTED_VERSION" | |
| echo "Current version: $CURRENT_VERSION" | |
| if [ "$CURRENT_VERSION" != "$EXPECTED_VERSION" ]; then | |
| echo "❌ Version mismatch! Expected $EXPECTED_VERSION but got $CURRENT_VERSION" | |
| echo "Updating version again..." | |
| sed -i "s/^version:.*/version: $EXPECTED_VERSION/" pubspec.yaml | |
| echo "Updated version:" | |
| grep "version:" pubspec.yaml | |
| else | |
| echo "✅ Version matches expected value" | |
| fi | |
| - name: Run tests (if available) | |
| run: | | |
| cd flutter | |
| if [ -d "test" ] && [ "$(ls -A test)" ]; then | |
| echo "Running tests..." | |
| flutter test | |
| else | |
| echo "No tests found, skipping..." | |
| fi | |
| - name: Setup pub.dev credentials | |
| run: | | |
| mkdir -p ~/.pub-cache | |
| cat <<EOF > ~/.pub-cache/credentials.json | |
| { | |
| "accessToken":"${{ secrets.PUB_DEV_ACCESS_TOKEN }}", | |
| "refreshToken":"${{ secrets.PUB_DEV_REFRESH_TOKEN }}", | |
| "tokenEndpoint":"https://accounts.google.com/o/oauth2/token", | |
| "scopes": ["openid", "https://www.googleapis.com/auth/userinfo.email"], | |
| "expiration": 1570721159347 | |
| } | |
| EOF | |
| - name: Dry run publish | |
| run: | | |
| cd flutter | |
| echo "🧪 Running dry-run publish for version ${{ needs.release.outputs.version }}" | |
| flutter pub publish --dry-run | |
| - name: Publish to pub.dev | |
| run: | | |
| cd flutter | |
| echo "🚀 Publishing version ${{ needs.release.outputs.version }} to pub.dev" | |
| flutter pub publish --force | |
| - name: Verify publication | |
| run: | | |
| echo "✅ Successfully published version ${{ needs.release.outputs.version }}" | |
| echo "Package should be available at: https://pub.dev/packages/refineui_system_icons" |