diff --git a/.github/workflows/cd.yml b/.github/workflows/cd.yml new file mode 100644 index 0000000..d39bd78 --- /dev/null +++ b/.github/workflows/cd.yml @@ -0,0 +1,29 @@ +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}}' + - '**' # 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: + environment: publish + runs-on: ubuntu-latest + steps: + - name: Checkout + uses: actions/checkout@v1 + - name: Publish + uses: k-paxian/dart-package-publisher@master + with: + credentialJson: ${{ secrets.CREDENTIAL_JSON }} + flutter: true + skipTests: true + dryRunOnly: false \ No newline at end of file diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index fe25760..7b27aeb 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -7,19 +7,19 @@ 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 @@ -27,13 +27,13 @@ jobs: - 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 ] + if: github.ref == 'refs/heads/main' && !contains(github.event.head_commit.message, 'chore(release):') + needs: [ analyze, test ] runs-on: ubuntu-latest environment: release steps: @@ -45,20 +45,11 @@ jobs: with: node-version: ${{env.NODE_VERSION}} registry-url: 'https://registry.npmjs.org' - - name: Build new release - run: npx semantic-release + - name: Install NPM dependencies 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 + run: npm ci + - name: Build new release + env: + GITHUB_TOKEN: ${{ secrets.GH_TOKEN }} shell: bash + run: npx semantic-release diff --git a/.releaserc.json b/.releaserc.json index 740671a..9ba8c42 100644 --- a/.releaserc.json +++ b/.releaserc.json @@ -1,4 +1,8 @@ { + "branches": [ + { "name": "beta-mode" }, + { "name": "main", "channel": "beta", "prerelease": "beta" } + ], "plugins": [ "@semantic-release/commit-analyzer", "@semantic-release/release-notes-generator", @@ -30,7 +34,7 @@ "pubspec.yaml", "CHANGELOG.md" ], - "message": "chore(release): ${nextRelease.version} [skip ci]\n\n${nextRelease.notes}" + "message": "chore(release): ${nextRelease.version}\n\n${nextRelease.notes}" }] ] } \ No newline at end of file