Skip to content

Merge pull request #78 from microsoft/security/adds-branch-policy #7

Merge pull request #78 from microsoft/security/adds-branch-policy

Merge pull request #78 from microsoft/security/adds-branch-policy #7

Workflow file for this run

name: Release
on:
push:
tags: ['microsoft_kiota_abstractions-v*']
branches: ['main']
permissions:
contents: write
jobs:
define-matrix:
runs-on: ubuntu-latest
name: 'Discover packages'
outputs:
packages: ${{ steps.packages.outputs.packages }}
steps:
- uses: actions/checkout@v4
- name: Discover packages
id: packages
run: |
packages=$(ls -d packages/* | xargs -n 1 basename | jq -R -s -c 'split("\n")[:-1]')
echo "packages=${packages}" >> $GITHUB_OUTPUT
publish-dart:
name: 'Publish packages'
permissions:
id-token: write # Required for authentication using OIDC
needs:
- define-matrix
runs-on: ubuntu-latest
strategy:
matrix:
package: ${{ fromJson(needs.define-matrix.outputs.packages) }}
steps:
- uses: actions/checkout@v4
- name: Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ env.PUB_CACHE }}
key: ${{ runner.os }}-pub
- name: Install dependencies
run: dart pub get
working-directory: packages/${{ matrix.package }}
- name: Prepare package
run: dart run tooling prepare ${{ matrix.package }}
working-directory: tooling
- name: Release dry run
working-directory: packages/${{ matrix.package }}
run: dart pub publish --dry-run
# only push to pub.dev when a tag was created
- name: Release to pub.dev
if: startsWith(github.ref, 'refs/tags/microsoft_kiota_abstractions-v')
working-directory: packages/${{ matrix.package }}
run: dart pub publish --force