|
| 1 | +name: Publish release |
| 2 | + |
| 3 | +on: |
| 4 | + pull_request: |
| 5 | + types: [closed] |
| 6 | + branches: |
| 7 | + - master |
| 8 | + push: |
| 9 | + tags: |
| 10 | + - "v*" |
| 11 | + |
| 12 | +permissions: |
| 13 | + contents: write |
| 14 | + id-token: write |
| 15 | + |
| 16 | +jobs: |
| 17 | + release_gh: |
| 18 | + name: GitHub Release |
| 19 | + if: github.event_name == 'push' || (github.event.pull_request.merged == true && contains(github.event.pull_request.labels.*.name, 'release')) |
| 20 | + runs-on: ubuntu-latest |
| 21 | + steps: |
| 22 | + - name: 📚 Git Checkout |
| 23 | + uses: actions/checkout@v6 |
| 24 | + |
| 25 | + - name: Get latest version |
| 26 | + run: | |
| 27 | + echo "PACKAGE_VERSION=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')" >> $GITHUB_ENV |
| 28 | +
|
| 29 | + - name: Download dSYMs |
| 30 | + if: github.event_name == 'pull_request' |
| 31 | + env: |
| 32 | + PR_BODY: ${{ github.event.pull_request.body }} |
| 33 | + run: | |
| 34 | + url=$(echo "$PR_BODY" | grep -oE 'https://[^ )]*dSYMs\.zip' | head -n 1) |
| 35 | + if [ -n "$url" ]; then |
| 36 | + echo "Found dSYMs URL: $url" |
| 37 | + curl -L -o dSYMs.zip "$url" |
| 38 | + else |
| 39 | + echo "No dSYMs.zip URL found in PR body." |
| 40 | + fi |
| 41 | +
|
| 42 | + - name: Generate Changelog |
| 43 | + run: awk '/^## \[/{if (f) exit; f=1; next} f' CHANGELOG.md > RELEASE_NOTES.md |
| 44 | + |
| 45 | + - name: GitHub Release |
| 46 | + env: |
| 47 | + GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 48 | + run: | |
| 49 | + FILES="" |
| 50 | + if [ -f dSYMs.zip ]; then |
| 51 | + FILES="dSYMs.zip" |
| 52 | + fi |
| 53 | + gh release create v${{ env.PACKAGE_VERSION }} \ |
| 54 | + --title "freeRASP ${{ env.PACKAGE_VERSION }}" \ |
| 55 | + --notes-file RELEASE_NOTES.md \ |
| 56 | + $FILES |
| 57 | +
|
| 58 | + publish_pub_dev: |
| 59 | + name: Publish release to pub.dev |
| 60 | + needs: release_gh |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - name: 📚 Git Checkout |
| 64 | + uses: actions/checkout@v6 |
| 65 | + |
| 66 | + - name: 🐦 Setup Flutter |
| 67 | + uses: subosito/flutter-action@v2 |
| 68 | + with: |
| 69 | + channel: stable |
| 70 | + flutter-version: 3.24.0 |
| 71 | + cache: true |
| 72 | + |
| 73 | + - name: 🎯 Setup Pub Credentials |
| 74 | + uses: dart-lang/setup-dart@v1 |
| 75 | + |
| 76 | + - name: 📦 Install Dependencies |
| 77 | + run: flutter pub get |
| 78 | + |
| 79 | + - name: 🚀 Publish to pub.dev |
| 80 | + run: flutter pub publish -f |
0 commit comments