-
Notifications
You must be signed in to change notification settings - Fork 40
52 lines (49 loc) · 1.94 KB
/
publish.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
name: Publish to pub.dev
## Caller of this workflow should use it as follows:
## jobs:
## publish:
## uses: dart-lang/setup-dart/.github/workflows/publish.yml@main [or a recent commit hash / version tag]
## # with:
## # working-directory: path/to/sub/directory
on:
workflow_call:
inputs:
environment:
description: If specified, the workflow is required to be run in this environment (with additional approvals).
required: false
type: string
working-directory:
description: The directory within the repository where the package is located (if not in the repository root).
required: false
type: string
jobs:
publish:
name: 'Publish to pub.dev'
environment: ${{ inputs.environment }}
permissions:
id-token: write # This is required for requesting the JWT
runs-on: ubuntu-latest
steps:
# Checkout repository
- uses: actions/checkout@v4
# Set up the Dart SDK and provision the OIDC token used for publishing.
# The `dart` command from this step will be shadowed by the one from the
# Flutter SDK below.
- uses: dart-lang/setup-dart@e630b99d28a3b71860378cafdc2a067c71107f94
# Download flutter SDK - needed for publishing Flutter packages. Can also
# publish pure Dart packages.
#
# The dart binary from a Flutter SDK facilitates publishing both Flutter
# and pure-dart packages.
- uses: flutter-actions/setup-flutter@54feb1e258158303e041b9eaf89314dcfbf6d38a
# Minimal package setup and dry run checks.
- name: Install dependencies
run: dart pub get
working-directory: ${{ inputs.working-directory }}
- name: Publish - dry run
run: dart pub publish --dry-run
working-directory: ${{ inputs.working-directory }}
# Publishing...
- name: Publish to pub.dev
run: dart pub publish -f
working-directory: ${{ inputs.working-directory }}