Skip to content

Commit

Permalink
chore: add CI workflow for publishing to pub.dev
Browse files Browse the repository at this point in the history
- Introduced a new GitHub Actions workflow in `ci.yml` to handle publishing to pub.dev for both prerelease and stable branches.
- The workflow includes steps for checking out the repository, setting up Flutter, and using the melos-action for versioning and publishing.
- Updated the existing `publish.yml` to trigger on tags instead of branches, streamlining the publishing process.
- Enhanced permissions for better access control during the CI/CD process.
  • Loading branch information
devaryakjha committed Dec 18, 2024
1 parent 8455ce3 commit 25b64c0
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 49 deletions.
56 changes: 56 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
name: Publish to pub.dev

on:
push:
branches:
- main
- stable

jobs:
prerelease:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: subosito/flutter-action@v2

- uses: bluefireteam/melos-action@v3
with:
run-versioning-prerelease: true
tag: true
git-email: "[email protected]"
git-name: "GitHub Actions Bot"
create-pr: true
publish-dry-run: true

stable:
if: github.ref == 'refs/heads/stable'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: subosito/flutter-action@v2

- uses: bluefireteam/melos-action@v3
with:
run-versioning: true
tag: true
git-email: "[email protected]"
git-name: "GitHub Actions Bot"
create-pr: true
publish-dry-run: true
56 changes: 7 additions & 49 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,55 +2,13 @@ name: Publish to pub.dev

on:
push:
branches:
- main
- stable
tags:
- "tagflow-v[0-9]+.[0-9]+.[0-9]+*"

jobs:
prerelease:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
publish:
permissions:
id-token: write
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: subosito/flutter-action@v2

- uses: bluefireteam/melos-action@v3
with:
run-versioning-prerelease: true
tag: true
git-email: "[email protected]"
git-name: "GitHub Actions Bot"
create-pr: true
publish-dry-run: true

stable:
if: github.ref == 'refs/heads/stable'
runs-on: ubuntu-latest
permissions:
id-token: write
contents: write
pull-requests: write

steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GITHUB_TOKEN }}

- uses: subosito/flutter-action@v2

- uses: bluefireteam/melos-action@v3
with:
run-versioning: true
tag: true
git-email: "[email protected]"
git-name: "GitHub Actions Bot"
create-pr: true
publish-dry-run: true
id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
with:
working-directory: packages/tagflow

0 comments on commit 25b64c0

Please sign in to comment.