Skip to content

Commit

Permalink
Add publish script
Browse files Browse the repository at this point in the history
  • Loading branch information
penfeizhou committed Sep 29, 2021
1 parent 124440a commit 4425d11
Show file tree
Hide file tree
Showing 3 changed files with 86 additions and 0 deletions.
41 changes: 41 additions & 0 deletions .github/workflows/publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,41 @@
name: Release
on:
release:
types: [published]
jobs:
build:
runs-on: macos-latest
steps:
- uses: actions/checkout@v1
- name: setup JDK 1.8
uses: actions/setup-java@v1
with:
java-version: 1.8
- uses: actions/setup-node@v1
with:
node-version: 10
registry-url: "https://registry.npmjs.org"
- name: Config Github Account
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
git config user.email "[email protected]"
git config user.name "pengfei.zhou"
git remote set-url origin https://x-access-token:${GITHUB_TOKEN}@github.com/${GITHUB_REPOSITORY}.git
git checkout master
- name: Install Cocoapods
run: |
gem install cocoapods
- name: Echo current Version
run: |
echo ${GITHUB_REF:11}>version
echo "Current Version is "${GITHUB_REF:11}
- name: Publish
run: |
sh publish.sh
env:
COCOAPODS_TRUNK_TOKEN: ${{ secrets.COCOAPODS_TRUNK_TOKEN }}
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
BINTARY_USER: ${{ secrets.BINTARY_USER }}
BINTARY_REPO: ${{ secrets.BINTARY_REPO }}
BINTARY_APIKEY: ${{ secrets.BINTARY_APIKEY }}
44 changes: 44 additions & 0 deletions publish.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
#!/usr/bin/env bash
##############################################################################
##
## Publish JS,Android,iOS
##
##############################################################################

CURRENT_DIR=$(cd $(dirname $0); pwd)
CURRENT_VERSION=$(cat $CURRENT_DIR/version)

echo "Current version is "$CURRENT_VERSION

## iOS
sed -i "" "s/\(version[ ]*= \)'[0-9 \.]*'/\1'$CURRENT_VERSION'/g" $CURRENT_DIR/DoricWebView.podspec

# git save
cd $CURRENT_DIR/

echo "Commit changes"
git add .
git commit -m "Release v${CURRENT_VERSION}"

## JS
cd $CURRENT_DIR && npm version $CURRENT_VERSION --allow-same-version

git tag ${CURRENT_VERSION}

git push

git push --tags

npm install doric-cli -g

npm install

cd example && npm install && cd ..


echo "Publish JS"
cd $CURRENT_DIR/ && npm publish
echo "Publish Android"
cd $CURRENT_DIR/example/android && ./gradlew clean :lib:uploadArchives
echo "Publish iOS"
cd $CURRENT_DIR && pod trunk push DoricWebView.podspec --allow-warnings
1 change: 1 addition & 0 deletions version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
0.1.0

0 comments on commit 4425d11

Please sign in to comment.