From 25b64c0bae9e9e5f7b5e7f9a8bb6c82ee63787bc Mon Sep 17 00:00:00 2001 From: devaryakjha Date: Thu, 19 Dec 2024 03:31:04 +0530 Subject: [PATCH] chore: add CI workflow for publishing to pub.dev - 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. --- .github/workflows/ci.yml | 56 +++++++++++++++++++++++++++++++++++ .github/workflows/publish.yml | 56 +++++------------------------------ 2 files changed, 63 insertions(+), 49 deletions(-) create mode 100644 .github/workflows/ci.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml new file mode 100644 index 0000000..fd370d1 --- /dev/null +++ b/.github/workflows/ci.yml @@ -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: "actions@github.com" + 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: "actions@github.com" + git-name: "GitHub Actions Bot" + create-pr: true + publish-dry-run: true diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index fd370d1..260f88e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -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: "actions@github.com" - 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: "actions@github.com" - 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