Skip to content

Commit a81b186

Browse files
authored
Merge pull request #38 from passageidentity/PSG-3992
PSG-3992
2 parents 66bf299 + 450b6c0 commit a81b186

File tree

1 file changed

+18
-4
lines changed

1 file changed

+18
-4
lines changed

.github/workflows/publish.yml

+18-4
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
name: Publish Flutter Package
22

33
on:
4-
workflow_dispatch:
4+
repository_dispatch:
5+
types: [publish]
56

67
jobs:
78
publish:
@@ -11,6 +12,8 @@ jobs:
1112
steps:
1213
- name: Check out code
1314
uses: actions/checkout@v3
15+
with:
16+
ref: ${{ github.event.client_payload.ref }}
1417

1518
- name: Set up Flutter
1619
uses: subosito/flutter-action@v2
@@ -24,8 +27,13 @@ jobs:
2427
env:
2528
PUB_CREDENTIALS: ${{ secrets.PUB_CREDENTIALS }}
2629
run: |
27-
mkdir -p ~/Library/Application\ Support/dart
28-
echo "$PUB_CREDENTIALS" > ~/Library/Application\ Support/dart/pub-credentials.json
30+
if [ -z "$XDG_CONFIG_HOME" ]; then
31+
CREDENTIALS_DIR="$HOME/.config/dart"
32+
else
33+
CREDENTIALS_DIR="$XDG_CONFIG_HOME/dart"
34+
fi
35+
mkdir -p "$CREDENTIALS_DIR"
36+
echo "$PUB_CREDENTIALS" > "$CREDENTIALS_DIR/pub-credentials.json"
2937
3038
- name: Dry run publish
3139
run: flutter pub publish --dry-run
@@ -34,4 +42,10 @@ jobs:
3442
run: yes | flutter pub publish
3543

3644
- name: Clean up authentication
37-
run: rm ~/Library/Application\ Support/dart/pub-credentials.json
45+
run: |
46+
if [ -z "$XDG_CONFIG_HOME" ]; then
47+
CREDENTIALS_DIR="$HOME/.config/dart"
48+
else
49+
CREDENTIALS_DIR="$XDG_CONFIG_HOME/dart"
50+
fi
51+
rm "$CREDENTIALS_DIR/pub-credentials.json"

0 commit comments

Comments
 (0)