Skip to content

Commit

Permalink
chore: setup semantic release, #1
Browse files Browse the repository at this point in the history
  • Loading branch information
luifr10 committed Mar 5, 2024
1 parent 9054f0c commit 83ce002
Show file tree
Hide file tree
Showing 3 changed files with 29 additions and 22 deletions.
19 changes: 19 additions & 0 deletions .github/workflows/cd.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
name: Publish to pub.dev

on:
push:
tags:
# must align with the tag-pattern configured on pub.dev, often just replace
# {{version}} with [0-9]+.[0-9]+.[0-9]+*
# - 'v[0-9]+.[0-9]+.[0-9]+*' # tag-pattern on pub.dev: 'v{{version}}'
# If you prefer tags like '1.2.3', without the 'v' prefix, then use:
- '[0-9]+.[0-9]+.[0-9]+*' # tag-pattern on pub.dev: '{{version}}'
# If your repository contains multiple packages consider a pattern like:
# - 'my_package_name-v[0-9]+.[0-9]+.[0-9]+*'

# Publish using the reusable workflow from dart-lang.
jobs:
publish:
permissions:
id-token: write # Required for authentication using OIDC
uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1
28 changes: 6 additions & 22 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,39 +7,37 @@ on:
branches: [ "main" ]

env:
NODE_VERSION: 18.14.0
NODE_VERSION: 20.8.1
FLUTTER_VERSION: '3.16.9'

jobs:
analyse:
analyze:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: $FLUTTER_VERSION
flutter-version: ${{env.FLUTTER_VERSION}}
channel: 'stable'
- run: flutter analyse
- run: flutter analyze

test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: $FLUTTER_VERSION
flutter-version: ${{env.FLUTTER_VERSION}}
channel: 'stable'
- run: flutter test

release:
if: github.ref == 'refs/heads/main'
needs: [ analyse, test ]
needs: [ analyze, test ]
runs-on: ubuntu-latest
environment: release
steps:
- uses: actions/checkout@v4
with:
token: ${{ secrets.GH_TOKEN }}
- name: Use Node.js ${{env.NODE_VERSION}}
uses: actions/setup-node@v4
with:
Expand All @@ -48,17 +46,3 @@ jobs:
- name: Build new release
run: npx semantic-release
shell: bash

publish:
if: github.ref == 'refs/heads/main'
runs-on: ubuntu-latest
needs: [ release ]
steps:
- uses: actions/checkout@v4
- uses: subosito/flutter-action@v2
with:
flutter-version: $FLUTTER_VERSION
channel: 'stable'
- name: Publish on pub.dev
run: dart publish
shell: bash
4 changes: 4 additions & 0 deletions .releaserc.json
Original file line number Diff line number Diff line change
@@ -1,4 +1,8 @@
{
"branches": [
{ "name": "beta-mode" },
{ "name": "main", "channel": "beta", "prerelease": "beta" }
],
"plugins": [
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
Expand Down

0 comments on commit 83ce002

Please sign in to comment.