-
-
Notifications
You must be signed in to change notification settings - Fork 10
158 lines (124 loc) Β· 4 KB
/
publish.yaml
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
149
150
151
152
153
154
155
156
157
158
name: publish
on:
push:
tags:
- '*-v*.*.*'
jobs:
to_publish:
runs-on: ubuntu-latest
permissions:
pull-requests: read
outputs:
package: ${{ steps.package.outputs.package }}
action: ${{ steps.action.outputs.action }}
brick: ${{ steps.brick.outputs.brick }}
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: π¦ Finding a package to publish
id: package
run: |
tag=${GITHUB_REF#refs/*/}
package=$(echo $tag | sed -En "s/^(.*)-v(.*)/\1/p")
if [[ -d "packages/$package" ]]; then
echo "::set-output name=package::${package}"
fi
- name: π₯ Finding an action to publish
id: action
if: steps.package.outputs.package == ''
run: |
tag=${GITHUB_REF#refs/*/}
action=$(echo $tag | sed -En "s/^(.*)-v(.*)/\1/p")
if [[ -d "actions/$action" ]]; then
echo "::set-output name=action::${action}"
fi
- name: 𧱠Finding a brick to publish
id: brick
if: steps.package.outputs.action == ''
run: |
tag=${GITHUB_REF#refs/*/}
brick=$(echo $tag | sed -En "s/^(.*)-v(.*)/\1/p")
if [[ -d "bricks/$brick" ]]; then
echo "::set-output name=brick::${brick}"
fi
failed_to_find:
needs: to_publish
if: needs.to_publish.outputs.package == '' && needs.to_publish.outputs.action == '' && needs.to_publish.outputs.brick == ''
runs-on: ubuntu-latest
steps:
- name: π’ No package, action or brick found
run: exit 1
publish_package:
needs: to_publish
if: needs.to_publish.outputs.package != ''
runs-on: ubuntu-latest
defaults:
run:
working-directory: packages/${{ needs.to_publish.outputs.package }}
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: π¦ Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: π¦ Get Dependencies
run: flutter pub get
- name: π Setup Pub Credentials
run: |
mkdir -p $XDG_CONFIG_HOME/dart
echo '${{ secrets.PUB_CREDENTIALS }}' > "$XDG_CONFIG_HOME/dart/pub-credentials.json"
- name: π΅ Dry Run
run: flutter pub publish --dry-run
- name: π’ Publish
run: flutter pub publish -f
publish_action:
needs: to_publish
if: needs.to_publish.outputs.action != ''
runs-on: ubuntu-latest
defaults:
run:
working-directory: actions/${{ needs.to_publish.outputs.action }}
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: π¦ Setup Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
- name: π¦ Get Dependencies
run: flutter pub get
- name: π Setup Pub Credentials
run: |
mkdir -p $XDG_CONFIG_HOME/dart
echo '${{ secrets.PUB_CREDENTIALS }}' > "$XDG_CONFIG_HOME/dart/pub-credentials.json"
- name: π΅ Dry Run
run: flutter pub publish --dry-run
- name: π’ Publish
run: flutter pub publish -f
publish_brick:
needs: to_publish
if: needs.to_publish.outputs.brick != ''
runs-on: ubuntu-latest
defaults:
run:
working-directory: bricks/${{ needs.to_publish.outputs.brick }}
steps:
- name: π Git Checkout
uses: actions/checkout@v3
- name: π― Setup Dart
uses: dart-lang/setup-dart@v1
with:
sdk: stable
- name: 𧱠Install mason
run: dart pub global activate mason_cli
- name: π Setup Mason Credentials
run: |
mkdir -p $XDG_CONFIG_HOME/mason
echo '${{ secrets.MASON_CREDENTIALS }}' > "$XDG_CONFIG_HOME/mason/mason-credentials.json"
- name: π΅ Dry Run
run: mason publish --dry-run
- name: π’ Publish
run: mason publish -f