From 22f879beb6bdeb5bdffff7814698548276b53a03 Mon Sep 17 00:00:00 2001 From: Daniel McCartney Date: Wed, 25 Oct 2023 15:26:04 -0700 Subject: [PATCH] build: publish dart on release, fix semver for kt and dart --- .github/workflows/publish-dart.yml | 36 ------------------------------ .github/workflows/release.yml | 32 ++++++++++++++++++++++++++ 2 files changed, 32 insertions(+), 36 deletions(-) delete mode 100644 .github/workflows/publish-dart.yml diff --git a/.github/workflows/publish-dart.yml b/.github/workflows/publish-dart.yml deleted file mode 100644 index 59821421..00000000 --- a/.github/workflows/publish-dart.yml +++ /dev/null @@ -1,36 +0,0 @@ -# .github/workflows/publish.yml -name: Publish to pub.dev -on: - push: - tags: - # must align with the tag-pattern configured on pub.dev - - 'v[0-9]+.[0-9]+.[0-9]+*' # tag-pattern on pub.dev: 'v' -jobs: - dart: - # https://dart.dev/tools/pub/automated-publishing - name: Release (dart) - permissions: - id-token: write # This is required for requesting the JWT - runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v3 - # Setup Dart SDK with JWT token https://github.com/dart-lang/setup-dart/blob/77b84bec90e9a0d07f68a3cedd3651ba9e606a12/.github/workflows/publish.yml#L33 - - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 - - run: dart pub get - working-directory: ./dart - - run: dev/dart/generate - - run: dart test - working-directory: ./dart - - name: Set Tag - run: | - TAG=`echo ${GITHUB_REF#refs/*/}` - echo "GIT_TAG=${TAG#v}" >> $GITHUB_ENV - - name: Prepublish - env: - RELEASE_VERSION: ${{ env.GIT_TAG }} - run: dev/dart/prepublish - - name: Verify pubspec - run: cat ./dart/pubspec.yaml - - name: Publish - run: dart pub publish --force - working-directory: ./dart diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6babfbc0..ac6f92c7 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -24,7 +24,39 @@ jobs: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} run: npm run semantic-release + dart: + # The `semantic-release` from JS calculates the version tag + needs: js + if: ${{ github.ref_name == 'main' }} + name: Release (dart) + # https://dart.dev/tools/pub/automated-publishing + permissions: + id-token: write # This is required for requesting the JWT + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + with: + fetch-depth: 0 + - uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46 + - run: dart pub get + working-directory: ./dart + - run: dev/dart/generate + - run: dart test + working-directory: ./dart + - name: Set Tag + run: | + TAG=`echo $(git describe --tags --abbrev=0)` + echo "GIT_TAG=${TAG#v}" >> $GITHUB_ENV + - run: dev/dart/prepublish + env: + RELEASE_VERSION: ${{ env.GIT_TAG }} + - name: Verify pubspec + run: cat ./dart/pubspec.yaml + - run: dart pub publish --force + working-directory: ./dart kotlin: + # The `semantic-release` from JS calculates the version tag + needs: js if: ${{ github.ref_name == 'main' }} name: Release (Kotlin) runs-on: ubuntu-latest