diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index f276b838..e555ee99 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -4,18 +4,6 @@ on: push: tags: - "[0-9]+.[0-9]+.[0-9]+*" - workflow_dispatch: - inputs: - dry_run: - description: 'Dry run (no actual publish)' - required: false - type: boolean - default: false - version: - description: 'Version to use for dry run' - required: false - type: string - default: '' env: DEVELOPER_DIR: /Applications/Xcode_15.4.app/Contents/Developer @@ -26,36 +14,31 @@ env: jobs: ci: runs-on: macos-14-xlarge - if: ${{ !inputs.dry_run }} + steps: - - uses: actions/checkout@v4 - - uses: actions/setup-java@v4 + - uses: actions/checkout@v3 + - uses: actions/setup-java@v2 with: distribution: ${{ env.JAVA_DISTRIBUTION }} java-version: ${{ env.JAVA_VERSION }} - - uses: subosito/flutter-action@v2 + - uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: flutter-version: ${{env.FLUTTER_VERSION}} - name: Run CI run: bash ./scripts/run_ci_tasks.sh release-plugin: - runs-on: ubuntu-latest - needs: [ ci] - if: ${{ !inputs.dry_run }} permissions: - contents: write - id-token: write + id-token: write # Required for authentication using OIDC + runs-on: ubuntu-latest + needs: [ ci ] steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 + - name: Get the version id: get_version - run: | - if [[ "${{ inputs.dry_run }}" == "true" && "${{ inputs.version }}" != "" ]]; then - echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT - else - echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - fi + run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + - name: Get the release notes id: get_release_notes env: @@ -67,24 +50,32 @@ jobs: awk "/## Version $VERSION/{flag=1;next}/## Version/{flag=0}flag" CHANGELOG.md echo ${delimiter} } >> $GITHUB_OUTPUT - - uses: actions/setup-java@v4 + + - uses: actions/setup-java@v2 with: distribution: ${{ env.JAVA_DISTRIBUTION }} java-version: ${{ env.JAVA_VERSION }} - - uses: subosito/flutter-action@v2 + + - name: Flutter action + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: flutter-version: ${{ env.FLUTTER_VERSION }} - run: flutter pub get + + - name: Publish Dart/Flutter package + run: flutter pub publish -f + - name: Github Release - if: ${{ !inputs.dry_run }} + uses: actions/create-release@v1.0.1 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} - uses: softprops/action-gh-release@v1 with: - name: ${{ steps.get_version.outputs.VERSION }} + tag_name: ${{ steps.get_version.outputs.VERSION }} + release_name: ${{ steps.get_version.outputs.VERSION }} body: ${{ steps.get_release_notes.outputs.NOTES }} draft: false prerelease: false + - name: Slack Notification uses: homoluctus/slatify@master if: failure() @@ -93,60 +84,46 @@ jobs: job_name: "Failed to release Flutter :(" url: ${{ secrets.MOBILE_SLACK_WEBHOOK }} - publish-dry-run: - needs: [ ci ] - if: ${{ inputs.dry_run }} - uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 - with: - dry-run: true - working-directory: . - sdk: any - - publish: - needs: [ ci ] - if: ${{ !inputs.dry_run }} - uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 - with: - working-directory: . - sdk: any - release-docs: runs-on: macos-14-xlarge needs: [ ci, release-plugin ] - if: ${{ !inputs.dry_run }} steps: - - uses: actions/checkout@v4 + - uses: actions/checkout@v3 + - name: Get the version id: get_version - run: | - if [[ "${{ inputs.dry_run }}" == "true" && "${{ inputs.version }}" != "" ]]; then - echo "VERSION=${{ inputs.version }}" >> $GITHUB_OUTPUT - else - echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT - fi - - uses: actions/setup-java@v4 + run: echo "VERSION=${GITHUB_REF/refs\/tags\//}" >> $GITHUB_OUTPUT + + - uses: actions/setup-java@v2 with: distribution: ${{ env.JAVA_DISTRIBUTION }} java-version: ${{ env.JAVA_VERSION }} - - uses: subosito/flutter-action@v2 + + - name: Flutter action + uses: subosito/flutter-action@44ac965b96f18d999802d4b807e3256d5a3f9fa1 with: flutter-version: ${{ env.FLUTTER_VERSION }} + - name: Setup GCP Auth uses: google-github-actions/auth@v2 with: credentials_json: ${{ secrets.GCP_SA_KEY }} + - name: Set up Cloud SDK uses: google-github-actions/setup-gcloud@v2 + - name: Build & Package docs run: | VERSION=${{ steps.get_version.outputs.VERSION }} flutter pub get bash ./scripts/docs.sh -gp $VERSION doc/api + - name: Upload docs env: - VERSION: ${{ steps.get_version.outputs.VERSION }} + VERSION: ${{ steps.get_version.outputs.VERSION }} run: | gsutil cp doc/$VERSION.tar.gz gs://ua-web-ci-prod-docs-transfer/libraries/flutter/$VERSION.tar.gz + - name: Slack Notification uses: homoluctus/slatify@master with: