Skip to content

Commit 8dc7842

Browse files
committed
check before publish
1 parent 9c09edf commit 8dc7842

1 file changed

Lines changed: 25 additions & 1 deletion

File tree

.github/workflows/release.yml

Lines changed: 25 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,26 @@ on:
66
push:
77
branches: [main]
88
jobs:
9+
check-release:
10+
runs-on: ubuntu-latest
11+
outputs:
12+
will-publish: ${{ steps.check.outputs.will-publish }}
13+
steps:
14+
- name: Checkout
15+
uses: actions/checkout@v4
16+
- name: Check for pending changesets
17+
id: check
18+
run: |
19+
CHANGESETS=$(find .changeset -name "*.md" -not -name "README.md" | wc -l | tr -d ' ')
20+
if [ "$CHANGESETS" -eq 0 ]; then
21+
echo "will-publish=true" >> $GITHUB_OUTPUT
22+
else
23+
echo "will-publish=false" >> $GITHUB_OUTPUT
24+
fi
25+
926
build-android:
27+
needs: check-release
28+
if: needs.check-release.outputs.will-publish == 'true'
1029
runs-on: ubuntu-latest
1130
steps:
1231
- name: Checkout
@@ -26,6 +45,8 @@ jobs:
2645
path: packages/async-storage/android/local_repo
2746

2847
build-apple:
48+
needs: check-release
49+
if: needs.check-release.outputs.will-publish == 'true'
2950
runs-on: macos-latest
3051
steps:
3152
- name: Checkout
@@ -46,7 +67,8 @@ jobs:
4667

4768
release:
4869
runs-on: ubuntu-latest
49-
needs: [build-android, build-apple]
70+
needs: [check-release, build-android, build-apple]
71+
if: '!failure() && !cancelled()'
5072
steps:
5173
- name: Checkout
5274
uses: actions/checkout@v4
@@ -57,11 +79,13 @@ jobs:
5779
- name: Install dependencies
5880
run: yarn
5981
- name: Download Android artifacts
82+
if: needs.check-release.outputs.will-publish == 'true'
6083
uses: actions/download-artifact@v4
6184
with:
6285
name: android-artifacts
6386
path: packages/async-storage/android/local_repo
6487
- name: Download Apple artifacts
88+
if: needs.check-release.outputs.will-publish == 'true'
6589
uses: actions/download-artifact@v4
6690
with:
6791
name: apple-artifacts

0 commit comments

Comments
 (0)