Skip to content

Error: ⚠️ GitHub Releases requires a tag #592

Closed
@HumanBot000

Description

@HumanBot000

But I am creating a tag inside the workflow

name: Flutter Release Workflow

on:
  push:
    branches:
      - master
    paths:
      - 'pubspec.yaml'
      - '**/*.dart'
permissions:
  contents: write
jobs:
  flutter:
    runs-on: ubuntu-latest

    steps:
      - name: Checkout repository
        uses: actions/checkout@v2

      - name: Check if version is increased
        id: version-check
        run: |
...
          # Check if the version has increased (including build number changes)
          if [ "$NEW_VERSION" == "$PREVIOUS_VERSION" ]; then
            echo "No new version detected."
            exit 0
          else
            echo "New version detected: $NEW_VERSION"
          fi

      - name: Set up Flutter
...

      - name: Cache Flutter dependencies
...

      - name: Set up JDK 17
...

      - name: Set JAVA_HOME environment variable
        run: echo "JAVA_HOME=${{ env.JAVA_HOME }}" >> $GITHUB_ENV

      - name: Update Gradle Java Home
...

      - name: Install dependencies
        run: flutter pub get

      - name: Run Dart fix and format
        run: |
          flutter pub get
          dart fix --apply
          dart format .

      - name: Generate changelog
        id: changelog
        run: |
...
      - name: Tag version and push
        run: |
          git config --global user.email "github-actions[bot]@users.noreply.github.com"
          git config --global user.name "github-actions[bot]"
          git tag "v${NEW_VERSION}"
          git push https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git "v${NEW_VERSION}"
      - name: Fetch tags again to ensure latest tag is available
        run: git fetch --tags
      - name: Build release APK
        run: flutter build apk --release --dart-define=GEONAMES_API_USER=humanbot000
      - name: Create GitHub release
        uses: softprops/action-gh-release@v1
        with:
          files: build/app/outputs/flutter-apk/app-release.apk
        env:
          GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

But the tag is created and also pushed. I see it inside my repository before the Create GitHub release step is started
Image

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions