-
Notifications
You must be signed in to change notification settings - Fork 38
148 lines (133 loc) · 4.75 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
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
name: Publish to pub.dev
on:
workflow_dispatch:
inputs:
mix:
type: boolean
description: publish mix
default: false
mix_lint:
type: boolean
description: publish mix_lint
default: false
mix_annotations:
type: boolean
description: publish mix_annotations
default: false
mix_generator:
type: boolean
description: publish mix_generator
default: false
remix:
type: boolean
description: publish remix
default: false
concurrency:
group: ${{ github.workflow }}-${{ github.event.pull_request.number || github.ref }}
cancel-in-progress: true
jobs:
publish-dry-run:
runs-on: ubuntu-latest
steps:
- name: Checkout mix repo
uses: actions/checkout@v4
- name: Install FVM
shell: bash
run: |
curl -fsSL https://fvm.app/install.sh | bash
fvm use ${{ inputs.flutter-version }} --force
- uses: kuhnroyal/flutter-fvm-config-action@v2
id: fvm-config-action
- uses: subosito/flutter-action@v2
with:
flutter-version: ${{ steps.fvm-config-action.outputs.FLUTTER_VERSION }}
channel: ${{ steps.fvm-config-action.outputs.FLUTTER_CHANNEL }}
- name: Setup Melos
uses: bluefireteam/melos-action@v3
- name: Run melos fix
run: |
if [[ "${{ github.event.inputs.mix_lint }}" == "true" ]]; then
cd packages/mix_lint && dart pub publish --dry-run && cd ../..
fi
if [[ "${{ github.event.inputs.mix_annotations }}" == "true" ]]; then
cd packages/mix_annotations && dart pub publish --dry-run && cd ../..
fi
if [[ "${{ github.event.inputs.mix_generator }}" == "true" ]]; then
cd packages/mix_generator && dart pub publish --dry-run && cd ../..
fi
if [[ "${{ github.event.inputs.mix }}" == "true" ]]; then
cd packages/mix && dart pub publish --dry-run && cd ../..
fi
if [[ "${{ github.event.inputs.remix }}" == "true" ]]; then
cd packages/remix && dart pub publish --dry-run && cd ../..
fi
shell: bash
test-mincompat:
needs: [publish-dry-run]
runs-on: ubuntu-latest
steps:
- name: Checkout mix repo
uses: actions/checkout@v4
- name: Run Tests
uses: ./.github/actions/test/
with:
token: ${{ secrets.GITHUB_TOKEN }}
flutter-version: 'mincompat'
test-stable:
needs: [publish-dry-run]
runs-on: ubuntu-latest
steps:
- name: Checkout mix repo
uses: actions/checkout@v4
- name: Run Tests
uses: ./.github/actions/test/
with:
token: ${{ secrets.GITHUB_TOKEN }}
prepare-matrix:
name: Selecting packages to publish
runs-on: ubuntu-latest
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
steps:
- id: set-matrix
run: |
matrix=()
if [[ "${{ github.event.inputs.mix_lint }}" == "true" ]]; then
matrix+=('{"name": "mix_lint", "path": "packages/mix_lint"}')
fi
if [[ "${{ github.event.inputs.mix_annotations }}" == "true" ]]; then
matrix+=('{"name": "mix_annotations", "path": "packages/mix_annotations"}')
fi
if [[ "${{ github.event.inputs.mix_generator }}" == "true" ]]; then
matrix+=('{"name": "mix_generator", "path": "packages/mix_generator"}')
fi
if [[ "${{ github.event.inputs.mix }}" == "true" ]]; then
matrix+=('{"name": "mix", "path": "packages/mix"}')
fi
if [[ "${{ github.event.inputs.remix }}" == "true" ]]; then
matrix+=('{"name": "remix", "path": "packages/remix"}')
fi
echo "matrix=$(IFS=,; echo "[${matrix[*]}]")" >> $GITHUB_OUTPUT
publish:
needs: [test-mincompat, test-stable, publish-dry-run, prepare-matrix]
environment: Production
runs-on: ubuntu-latest
strategy:
max-parallel: 1
matrix:
package: ${{fromJSON(needs.prepare-matrix.outputs.matrix)}}
steps:
- uses: actions/checkout@v4
- name: '>> publish ${{ matrix.package.name }} package to pub.dev <<'
id: publish
uses: k-paxian/dart-package-publisher@master
with:
accessToken: ${{ secrets.OAUTH_ACCESS_TOKEN }}
refreshToken: ${{ secrets.OAUTH_REFRESH_TOKEN }}
relativePath: ${{ matrix.package.path }}
- name: 'Commit release tag'
if: steps.publish.outputs.success
uses: hole19/git-tag-action@master
env:
TAG: ${{steps.publish.outputs.package}}-${{steps.publish.outputs.localVersion}}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}