chore(ci): create tag and publish when pubspec version changes

This commit is contained in:
ricardodalarme 2023-03-24 01:24:23 -03:00
parent 2a93440b85
commit d10765ad75
3 changed files with 45 additions and 13 deletions

27
.github/workflows/auto-tag.yml vendored Normal file
View File

@ -0,0 +1,27 @@
name: Auto Tag
on:
workflow_run:
workflows: [Code Check]
types:
- completed
branches:
- main
jobs:
auto-tag:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: "Auto Tag when the pubspec.yaml version changes"
uses: jacopocarlini/action-autotag@3.0.0
with:
GITHUB_TOKEN: ${{ secrets.TAG_TOKEN }}
tag_prefix: "v"

View File

@ -20,6 +20,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Run Flutter Test
run: flutter test
@ -33,6 +34,7 @@ jobs:
- uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Run Flutter Format
run: dart format --set-exit-if-changed .

View File

@ -1,30 +1,33 @@
name: release
name: Publish to pub.dev
on:
workflow_run:
workflows: [Code Check]
types:
- completed
branches:
- main
push:
tags:
- "v[0-9]+.[0-9]+.[0-9]"
jobs:
release:
if: ${{ github.event.workflow_run.conclusion == 'success' }}
publish:
runs-on: ubuntu-latest
permissions:
id-token: write
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Install Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: "Install Flutter"
uses: subosito/flutter-action@v2
with:
channel: "stable"
cache: true
- name: Get all Flutter Packages
run: flutter pub get
- name: Publish
uses: sakebook/actions-flutter-pub-publisher@v1.4.1
with:
credential: ${{ secrets.CREDENTIAL_JSON }}
- name: Publish to pub.dev
run: flutter pub publish