Skip to content

Commit 54b55ec

Browse files
committed
chore: updated publish_pub_dev job
1 parent 5553c9b commit 54b55ec

File tree

3 files changed

+26
-16
lines changed

3 files changed

+26
-16
lines changed

.github/workflows/publish-draft.yaml

Lines changed: 18 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
name: publish
1+
name: publish-draft
22
on:
33
push:
44
tags: # trigger the publish job on tag creation
@@ -23,24 +23,27 @@ jobs:
2323
runs-on: ubuntu-latest
2424
steps:
2525
- uses: actions/checkout@v4
26-
- name: Install Dart
27-
uses: dart-lang/setup-dart@v1
2826

2927
- name: Append GITHUB_RUN_NUMBER to version
30-
run: |
31-
VERSION=$(grep 'version:' pubspec.yaml | cut -d ' ' -f 2)
32-
echo "Current version: $VERSION"
33-
NEW_VERSION="$VERSION+${GITHUB_RUN_NUMBER}"
34-
echo "New version: $NEW_VERSION"
35-
sed -i "s/version: $VERSION/version: $NEW_VERSION/g" pubspec.yaml
36-
cat pubspec.yaml
28+
run: ./update_version.sh
3729

38-
- name: Dry run publish package
39-
run: dart pub publish --dry-run # Perform a dry run first
30+
- name: Publish package
31+
uses: sakebook/[email protected]
32+
with:
33+
credential: ${{ secrets.CREDENTIAL_JSON }}
34+
flutter_package: true
35+
skip_test: true
36+
dry_run: true
4037

41-
#- name: Publish package
42-
# run: |
43-
# dart pub publish --force --token ${{ secrets.PUB_TOKEN }}
38+
- name: Git commit the updated pubspec.yaml
39+
run: |
40+
git config --global user.name "GitHub Actions"
41+
git config --global user.email "[email protected]"
42+
git add pubspec.yaml
43+
if [ -n "$(git status --porcelain)" ]; then
44+
git commit -m "chore: updated the version of pubspec.yaml"
45+
git push
46+
fi
4447
4548
deploy:
4649
needs: publish_pub_dev

pubspec.yaml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
name: surrealdb_wasm
22
description: Flutter SurrealDB WebAssembly(WASM) package
3-
version: 0.7.0
3+
version: 0.7.0+1
44
repository: https://github.com/limcheekin/surrealdb_wasm
55

66
environment:

update_version.sh

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
VERSION=$(grep 'version:' pubspec.yaml | cut -d ' ' -f 2)
2+
echo "Current version: $VERSION"
3+
BASE_VERSION=$(echo $VERSION | cut -d'+' -f1)
4+
NEW_VERSION="$BASE_VERSION+$GITHUB_RUN_NUMBER"
5+
echo "New version: $NEW_VERSION"
6+
sed -i "s/version: $VERSION/version: $NEW_VERSION/g" pubspec.yaml
7+
cat pubspec.yaml

0 commit comments

Comments
 (0)