diff --git a/.github/workflows/release_pub.yml b/.github/workflows/release_pub.yml deleted file mode 100644 index c99f9a8f4..000000000 --- a/.github/workflows/release_pub.yml +++ /dev/null @@ -1,39 +0,0 @@ -name: release_pub - -on: - release: - types: [published] - -concurrency: - group: ${{ github.workflow }}-${{ github.ref }} - cancel-in-progress: true - -jobs: - release: - permissions: - id-token: write # Required for authentication using OIDC - runs-on: ubuntu-latest - steps: - - name: 📚 Checkout branch - uses: actions/checkout@v4 - with: - fetch-depth: 0 - - # Set up the Dart SDK and provision the OIDC token used for publishing. - - name: đŸŽ¯ Setup Dart - uses: dart-lang/setup-dart@v1 - - - name: đŸĻ Install Flutter - uses: subosito/flutter-action@v2 - - - name: đŸ“Ļ Install Tools - run: flutter pub global activate melos - - - name: 🔧 Bootstrap Workspace - run: melos bootstrap --verbose - - - name: đŸŒĩ Dry Run - run: melos run lint:pub - - - name: 🚀 Release to pub.dev - run: melos run release:pub \ No newline at end of file diff --git a/.github/workflows/release_publish.yml b/.github/workflows/release_publish.yml new file mode 100644 index 000000000..69f5be6bc --- /dev/null +++ b/.github/workflows/release_publish.yml @@ -0,0 +1,68 @@ +name: release_publish + +on: + push: + tags: + - 'v[0-9]+.[0-9]+.[0-9]+' # tag-pattern for regular releases + - 'v[0-9]+.[0-9]+.[0-9]+-*' # tag-pattern for pre-releases + workflow_dispatch: # Allow manual triggering of the workflow + +concurrency: + group: ${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + +jobs: + release: + permissions: + contents: write # Required to creating release + id-token: write # Required for authentication using OIDC + runs-on: ubuntu-latest + steps: + - name: 📚 Checkout branch + uses: actions/checkout@v4 + with: + fetch-depth: 0 + token: ${{ secrets.BOT_GITHUB_API_TOKEN }} + + # Set up the Dart SDK and provision the OIDC token used for publishing. + - name: đŸŽ¯ Setup Dart + uses: dart-lang/setup-dart@v1 + + - name: đŸĻ Install Flutter + uses: subosito/flutter-action@v2 + + - name: đŸ“Ļ Install Tools + run: flutter pub global activate melos + + - name: 🔧 Bootstrap Workspace + run: melos bootstrap --verbose + + - name: đŸŒĩ Dry Run + run: melos run lint:pub + + - name: đŸ“ĸ Release to pub.dev + run: melos run release:pub + + - name: đŸˇī¸ Extract Version Info + id: extract_version + shell: bash + run: | + set -euo pipefail + + tag_name="${{ github.ref_name }}" + echo "đŸ“Ļ Tag: $tag_name" + + # Check if this is a pre-release (contains hyphen after version) + is_prerelease=$([[ $tag_name == *-* ]] && echo true || echo false) + echo "â„šī¸ Pre-release: $is_prerelease" + + echo "tag=$tag_name" >> "$GITHUB_OUTPUT" + echo "prerelease=$is_prerelease" >> "$GITHUB_OUTPUT" + + - name: 🚀 Create GitHub Release + uses: softprops/action-gh-release@v2 + with: + generate_release_notes: true + tag_name: ${{ steps.extract_version.outputs.tag }} + prerelease: ${{ steps.extract_version.outputs.prerelease }} + token: ${{ secrets.BOT_GITHUB_API_TOKEN }} \ No newline at end of file diff --git a/.github/workflows/release_github.yml b/.github/workflows/release_tag.yml similarity index 68% rename from .github/workflows/release_github.yml rename to .github/workflows/release_tag.yml index bcc905c95..3767e857a 100644 --- a/.github/workflows/release_github.yml +++ b/.github/workflows/release_tag.yml @@ -1,4 +1,4 @@ -name: release_github +name: release_tag on: push: @@ -13,12 +13,15 @@ jobs: # Only run this job for commits that indicate a release if: "${{ startsWith(github.event.head_commit.message, 'chore(repo): release') }}" runs-on: ubuntu-latest + permissions: + contents: write # Required to create and push tags steps: - name: 📚 Checkout branch uses: actions/checkout@v4 with: fetch-depth: 0 + token: ${{ secrets.BOT_GITHUB_API_TOKEN }} - name: đŸˇī¸ Extract Version Tag id: extract_tag @@ -34,23 +37,20 @@ jobs: if [[ "$commit_msg" =~ $version_regex ]]; then version="${BASH_REMATCH[0]}" - is_prerelease=$([[ $version == *-* ]] && echo true || echo false) - echo "✅ Found version tag: $version" - echo "â„šī¸ Pre-release: $is_prerelease" - echo "tag=$version" >> "$GITHUB_OUTPUT" - echo "prerelease=$is_prerelease" >> "$GITHUB_OUTPUT" else echo "::error ::❌ No SemVer tag found in commit message." echo "::error ::Expected something like: 'chore(repo): release v1.2.3[-beta]'" exit 1 fi - - name: 🚀 Create GitHub Release - uses: softprops/action-gh-release@v1 - with: - generate_release_notes: true - tag_name: ${{ steps.extract_tag.outputs.tag }} - prerelease: ${{ steps.extract_tag.outputs.prerelease }} - token: ${{ secrets.BOT_GITHUB_API_TOKEN }} \ No newline at end of file + - name: 🚀 Create and Push Tag + shell: bash + run: | + git config user.name "Stream SDK Bot" + git config user.email "60655709+Stream-SDK-Bot@users.noreply.github.com" + + echo "Creating and pushing tag: ${{ steps.extract_tag.outputs.tag }}" + git tag ${{ steps.extract_tag.outputs.tag }} + git push origin ${{ steps.extract_tag.outputs.tag }} \ No newline at end of file