diff --git a/.github/actions/setup-publish/action.yml b/.github/actions/setup-publish/action.yml new file mode 100644 index 00000000..21188740 --- /dev/null +++ b/.github/actions/setup-publish/action.yml @@ -0,0 +1,30 @@ +name: Set up Flutter and Dart SDK for publishing +description: Set up the environment for publishing the Flutter libraries to pub.dev + +inputs: + flutter: + description: The version of Flutter to use + required: true + + working-directory: + description: The directory of the package to publish + required: true + +runs: + using: composite + + steps: + - name: Install Flutter + uses: subosito/flutter-action@48cafc24713cca54bbe03cdc3a423187d413aafa + with: + flutter-version: ${{ inputs.flutter }} + channel: stable + cache: true + + - name: Install Flutter dependencies + working-directory: ${{ inputs.working-directory }} + run: flutter pub get + shell: bash + + - name: Setup Dart SDK for publishing # With JWT token + uses: dart-lang/setup-dart@b64355ae6ca0b5d484f0106a033dd1388965d06d diff --git a/.github/workflows/publish-af.yml b/.github/workflows/publish-af.yml index daf82e7b..3d0f90a1 100644 --- a/.github/workflows/publish-af.yml +++ b/.github/workflows/publish-af.yml @@ -5,11 +5,28 @@ on: tags: - 'af-v[0-9]+.[0-9]+.[0-9]+*' +env: + flutter: '3.x' + jobs: publish: + name: Publish auth0_flutter to pub.dev + environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }} + runs-on: ubuntu-latest + permissions: id-token: write - uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 - with: - environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }} - working-directory: auth0_flutter + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Setup Flutter and Dart SDK + uses: ./.github/actions/setup-publish + with: + flutter: ${{ env.flutter }} + working-directory: auth0_flutter + + - name: Publish + run: dart pub publish -f + working-directory: auth0_flutter diff --git a/.github/workflows/publish-afpi.yml b/.github/workflows/publish-afpi.yml index b5fde6e2..56147aeb 100644 --- a/.github/workflows/publish-afpi.yml +++ b/.github/workflows/publish-afpi.yml @@ -5,11 +5,28 @@ on: tags: - 'afpi-v[0-9]+.[0-9]+.[0-9]+*' +env: + flutter: '3.x' + jobs: publish: + name: Publish auth0_flutter_platform_interface to pub.dev + environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }} + runs-on: ubuntu-latest + permissions: id-token: write - uses: dart-lang/setup-dart/.github/workflows/publish.yml@v1 - with: - environment: ${{ github.event.pull_request.head.repo.fork && 'external' || 'internal' }} - working-directory: auth0_flutter_platform_interface + + steps: + - name: Checkout + uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 + + - name: Setup Flutter and Dart SDK + uses: ./.github/actions/setup-publish + with: + flutter: ${{ env.flutter }} + working-directory: auth0_flutter_platform_interface + + - name: Publish + run: dart pub publish -f + working-directory: auth0_flutter_platform_interface