Skip to content

Commit

Permalink
feat: add release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
clragon committed Nov 9, 2024
1 parent 0a94e9b commit 031e112
Show file tree
Hide file tree
Showing 5 changed files with 86 additions and 18 deletions.
30 changes: 16 additions & 14 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -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
- 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
3 changes: 1 addition & 2 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ name: publish

on:
workflow_dispatch:
# This workflow must be run from a Tag. A branch is not allowed.

jobs:
publish:
Expand All @@ -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
67 changes: 67 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -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
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
## [4.1.0] - 2024-11-09
## [Unreleased]

### Added

Expand Down
2 changes: 1 addition & 1 deletion pubspec.yaml
Original file line number Diff line number Diff line change
@@ -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:
Expand Down

0 comments on commit 031e112

Please sign in to comment.