From 031e1124b60589682fcfc4272aa6c5bf37179a86 Mon Sep 17 00:00:00 2001 From: clragon Date: Sat, 9 Nov 2024 20:30:33 +0100 Subject: [PATCH] feat: add release workflow --- .github/workflows/build.yml | 30 ++++++++-------- .github/workflows/publish.yml | 3 +- .github/workflows/release.yml | 67 +++++++++++++++++++++++++++++++++++ CHANGELOG.md | 2 +- pubspec.yaml | 2 +- 5 files changed, 86 insertions(+), 18 deletions(-) create mode 100644 .github/workflows/release.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 60d506f..ca4014f 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,20 +1,22 @@ name: build -on: + +on: push: branches: - master -jobs: - build: + +jobs: + build: runs-on: ubuntu-latest steps: - - uses: actions/checkout@v1 - - uses: actions/setup-java@v1 - with: - java-version: '12.x' - - uses: subosito/flutter-action@v1 - with: - channel: 'stable' - - run: flutter pub get - - run: flutter analyze - - run: flutter test --coverage --coverage-path coverage/lcov.info - - uses: codecov/codecov-action@v1 \ No newline at end of file + - uses: actions/checkout@v1 + - uses: actions/setup-java@v1 + with: + java-version: "12.x" + - uses: subosito/flutter-action@v1 + with: + channel: "stable" + - run: flutter pub get + - run: flutter analyze + - run: flutter test --coverage --coverage-path coverage/lcov.info + - uses: codecov/codecov-action@v1 diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index bd501f1..0c20b0e 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -2,6 +2,7 @@ name: publish on: workflow_dispatch: + # This workflow must be run from a Tag. A branch is not allowed. jobs: publish: @@ -15,7 +16,5 @@ jobs: - uses: subosito/flutter-action@v2 - name: Install dependencies run: dart pub get - - name: Publish - dry run - run: dart pub publish --dry-run - name: Publish to pub.dev run: dart pub publish -f diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml new file mode 100644 index 0000000..ff0aebb --- /dev/null +++ b/.github/workflows/release.yml @@ -0,0 +1,67 @@ +name: release + +on: + workflow_dispatch: + inputs: + version: + description: "Version to bump" + required: true + type: choice + options: + - major + - minor + - patch + +env: + VERSION_BUMP: ${{ github.event.inputs.version }} + +jobs: + release: + if: ${{ github.ref == 'refs/heads/master' }} + runs-on: ubuntu-latest + steps: + - name: Setup actions + uses: actions/checkout@v3 + + - name: Setup flutter + uses: subosito/flutter-action@v2 + with: + channel: "stable" + cache: true + + - name: Setup cider + run: dart pub global activate cider + + - name: Install dependencies + run: flutter pub get + + - name: Run tests + run: flutter test + + - name: Bump and release version + run: | + cider bump ${{ env.VERSION_BUMP }} + cider release + + - name: Get new version + run: echo "VERSION=$(cider version)" >> $GITHUB_ENV + + - name: Commit version increase + uses: EndBug/add-and-commit@v9 + with: + message: "chore: increase version" + default_author: github_actions + add: | + pubspec.yaml + CHANGELOG.md + + - name: Get version changelog + run: | + echo "$(cider describe ${{ env.VERSION }} --only-body)" > changes + + - name: Create release + uses: softprops/action-gh-release@v1 + with: + token: ${{ secrets.GITHUB_TOKEN }} + tag_name: ${{ env.VERSION }} + body_path: changes diff --git a/CHANGELOG.md b/CHANGELOG.md index a0636e8..0db6331 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,4 +1,4 @@ -## [4.1.0] - 2024-11-09 +## [Unreleased] ### Added diff --git a/pubspec.yaml b/pubspec.yaml index 59f8faf..dace5dc 100644 --- a/pubspec.yaml +++ b/pubspec.yaml @@ -1,6 +1,6 @@ name: infinite_scroll_pagination description: Lazily load and display pages of items as the user scrolls down your screen. -version: 4.1.0 +version: 4.0.0 homepage: https://github.com/EdsonBueno/infinite_scroll_pagination environment: