feat: add publishing via workflow dispatch #13
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: Publish release | |
| on: | |
| pull_request: | |
| types: [closed] | |
| branches: | |
| - "master" | |
| push: | |
| tags: | |
| - "v*" | |
| permissions: | |
| contents: write | |
| id-token: write | |
| jobs: | |
| release_gh: | |
| name: GitHub Release | |
| if: contains(github.event.pull_request.labels.*.name, 'release') | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: 📚 Git Checkout | |
| uses: actions/checkout@v6 | |
| - name: Get latest version | |
| run: | | |
| echo "PACKAGE_VERSION=$(grep '^version: ' pubspec.yaml | cut -d ' ' -f 2 | tr -d '\r')" >> $GITHUB_ENV | |
| - name: Download dSYMs | |
| if: github.event_name == 'pull_request' | |
| env: | |
| PR_BODY: ${{ github.event.pull_request.body }} | |
| run: | | |
| url=$(echo "$PR_BODY" | grep -oE 'https://[^ )]*dSYMs\.zip' | head -n 1) | |
| if [ -n "$url" ]; then | |
| echo "Found dSYMs URL: $url" | |
| curl -L -o dSYMs.zip "$url" | |
| else | |
| echo "No dSYMs.zip URL found in PR body." | |
| fi | |
| - name: Generate Changelog | |
| run: awk '/^## \[/{if (f) exit; f=1; next} f' CHANGELOG.md > RELEASE_NOTES.md | |
| - name: 🏷️ Push Release Tag | |
| run: | | |
| git config --global user.name "github-actions[bot]" | |
| git config --global user.email "github-actions[bot]@users.noreply.github.com" | |
| git tag v${{ env.PACKAGE_VERSION }} | |
| git push origin v${{ env.PACKAGE_VERSION }} | |
| - name: GitHub Release | |
| env: | |
| GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| run: | | |
| FILES="" | |
| if [ -f dSYMs.zip ]; then | |
| FILES="dSYMs.zip" | |
| fi | |
| gh release create v${{ env.PACKAGE_VERSION }} \ | |
| --title "freeRASP ${{ env.PACKAGE_VERSION }}" \ | |
| --notes-file RELEASE_NOTES.md \ | |
| $FILES |