blob: 8d417c46d546a6451c0bb5d63cb9eeee55ece773 [file] [log] [blame]
# A CI configuration to auto-publish pub packages.
name: Publish
# Callers of this workflow should use it as follows:
#
# name: Publish
# on:
# pull_request:
# branches: [ main ]
# push:
# tags: [ 'v[0-9]+.[0-9]+.[0-9]+*' ]
# jobs:
# publish:
# uses: dart-lang/ecosystem/.github/workflows/publish.yml@main
# Callers may optionally specify the version of the SDK to use when publishing a
# package. This can be useful if your package has a very recent minimum SDK
# constraint. This is done via the `sdk` input parameter. Note that this
# parameter is not required; it defaults to `stable` - using the most recent
# stable release of the Dart SDK. To pass this value:
#
# jobs:
# publish:
# uses: dart-lang/ecosystem/.github/workflows/publish.yml@main
# with:
# sdk: beta
on:
workflow_call:
inputs:
sdk:
description: >-
The channel, or a specific version from a channel, to install
('2.19.0','stable', 'beta', 'dev'). Using one of the three channels
will give you the latest version published to that channel.
default: "stable"
required: false
type: string
jobs:
publish:
# These permissions are required for authentication using OIDC and to enable
# us to create comments on PRs.
permissions:
id-token: write
pull-requests: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@ac593985615ec2ede58e132d2e21d2b1cbd6127c
- uses: dart-lang/setup-dart@a57a6c04cf7d4840e88432aad6281d1e125f0d46
with:
sdk: ${{ inputs.sdk }}
- name: Install firehose
run: dart pub global activate firehose
- name: Validate packages
if: ${{ github.event_name == 'pull_request' }}
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
ISSUE_NUMBER: ${{ github.event.number }}
run: dart pub global run firehose --validate
- name: Publish packages
if: ${{ github.event_name == 'push' }}
run: dart pub global run firehose --publish