From 9f68f93fc4486a95bc48c0542098849d4f8805e9 Mon Sep 17 00:00:00 2001 From: Rastislav Date: Tue, 19 May 2026 13:06:24 +0200 Subject: [PATCH] publishing --- .github/workflows/publish.yml | 42 +++++++++++++++++++++++++++++++++++ .github/workflows/release.yml | 25 +++------------------ CONTRIBUTING.md | 6 +++-- README.md | 15 ++++++++++--- 4 files changed, 61 insertions(+), 27 deletions(-) create mode 100644 .github/workflows/publish.yml diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml new file mode 100644 index 0000000..ab06923 --- /dev/null +++ b/.github/workflows/publish.yml @@ -0,0 +1,42 @@ +name: Publish to pub.dev + +on: + push: + tags: + - '*.*.*' + +jobs: + validate: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v4 + + - name: Set up Dart SDK + uses: dart-lang/setup-dart@v1 + + - name: Install dependencies + run: dart pub get + + - name: Verify formatting + run: dart format --output=none --set-exit-if-changed . + + - name: Analyze package + run: dart analyze + + - name: Run package:test suite + run: dart test + + - name: Run legacy assertion suite + run: dart --enable-asserts run test/all.dart + + - name: Validate publishable package + run: dart pub publish --dry-run + + publish-pub-dev: + if: github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') + needs: validate + permissions: + id-token: write + uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 50b0547..09793fc 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -1,9 +1,9 @@ name: Release on: - push: - tags: - - 'v*' + release: + types: + - published jobs: validate: @@ -33,22 +33,3 @@ jobs: - name: Validate publishable package run: dart pub publish --dry-run - - github-release: - needs: validate - runs-on: ubuntu-latest - permissions: - contents: write - - steps: - - name: Create GitHub release - uses: softprops/action-gh-release@v2 - with: - generate_release_notes: true - prerelease: ${{ contains(github.ref_name, '-') }} - - publish-pub-dev: - needs: validate - permissions: - id-token: write - uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index b9a9dfd..6c2da8e 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -39,10 +39,12 @@ Tagged releases are handled through GitHub Actions. Use the current package version from `pubspec.yaml` and create a matching Git tag: ```sh -git tag v -git push origin v +git tag +git push origin ``` +Then publish a GitHub release for the same tag. + If the package name is being published to pub.dev for the first time, the first release must be performed manually before automated publishing can be used. ## Reporting Issues diff --git a/README.md b/README.md index b5c4cda..f5e94f4 100644 --- a/README.md +++ b/README.md @@ -88,11 +88,20 @@ dart analyze dart test dart --enable-asserts run test/all.dart dart pub publish --dry-run -git tag v -git push origin v +git tag +git push origin ``` -If `flutter_ed448` is being published to pub.dev for the first time, the initial release must still be published manually. After that, the included GitHub Actions release workflow can publish tagged versions automatically once pub.dev automated publishing is configured for this repository. +After pushing the version tag, publish a GitHub release for the same tag, for example `0.2.0`. + +The workflows are split as follows: + +- Publishing a GitHub release runs the repository `Release` workflow. +- Pushing a matching version tag runs the `Publish to pub.dev` workflow. + +The pub.dev publish step must stay tag-triggered. Dart's official automated publishing flow only allows GitHub Actions publishing when the workflow was triggered by a pushed git tag, not only by a GitHub release event. + +If `flutter_ed448` is being published to pub.dev for the first time, the initial release must still be published manually. After that, automated publishing can be enabled for this repository on pub.dev using the plain version tag pattern `{{version}}`. ## Licensing