Merge pull request #65 from microsoft/ci/missing-license-files #1
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Release | |
on: | |
push: | |
tags: | |
- '*' | |
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: Download Changelog | |
uses: actions/download-artifact@v4 | |
with: | |
name: changelog | |
- 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: Prepare Release Files | |
working-directory: packages/${{ matrix.package }} | |
run: | | |
# Replace the version in the pubspec.yaml file | |
sed -i 's/^version:.*$/version: ${GITHUB_REF_NAME}/' pubspec.yaml | |
- name: Release dry run | |
working-directory: packages/${{ matrix.package }} | |
run: dart pub publish --dry-run | |
- name: Release to pub.dev | |
working-directory: packages/${{ matrix.package }} | |
run: dart pub publish --force |