Publish to Github #27
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 to Pub.dev & Github | |
| on: | |
| workflow_dispatch: | |
| pull_request: | |
| types: | |
| - closed | |
| branches: | |
| - main | |
| - rel/** | |
| permissions: | |
| id-token: write # Required for authentication using OIDC | |
| contents: write | |
| jobs: | |
| publish: | |
| if: | | |
| github.event_name == 'workflow_dispatch' || | |
| (github.event.pull_request.merged == true && | |
| contains(github.event.pull_request.title, 'chore: Release')) | |
| runs-on: ubuntu-latest | |
| outputs: | |
| version: ${{ steps.version.outputs.version }} | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v5 | |
| - name: Set up Flutter | |
| uses: ./.github/actions/setup-flutter | |
| # This step is what enables Dart's OIDC "trusted publishing" wiring. | |
| # Even though you publish with flutter, OIDC creds are handled via Dart tooling. | |
| - uses: dart-lang/setup-dart@v1 | |
| - name: Get version from pubspec.yaml | |
| id: version | |
| run: | | |
| VERSION=$(grep "^version:" pubspec.yaml | sed 's/version: //' | tr -d ' ') | |
| echo "version=$VERSION" >> $GITHUB_OUTPUT | |
| echo "Version: $VERSION" | |
| - name: Publish to Pub.dev | |
| run: | | |
| flutter pub publish --force | |
| create-release: | |
| needs: publish | |
| uses: OneSignal/sdk-actions/.github/workflows/github-release.yml@main | |
| with: | |
| version: ${{ needs.publish.outputs.version }} |