-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
61baa57
commit c4d8c57
Showing
3 changed files
with
97 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
name: Release Next Version | ||
#on: | ||
# workflow_dispatch: | ||
# inputs: | ||
# release_tag: | ||
# description: 'Release Tag' | ||
# required: true | ||
# type: string | ||
# release_code: | ||
# description: 'Release Code' | ||
# required: true | ||
# type: string | ||
on: | ||
push: | ||
branches: [ "main" ] | ||
pull_request: | ||
branches: [ "main" ] | ||
env: | ||
# NEW_VERSION: ${{ github.event.inputs.release_tag }} | ||
# NEW_VERSION_CODE: ${{ github.event.inputs.release_code }} | ||
NEW_VERSION: 1.8.0 | ||
NEW_VERSION_CODE: 13 | ||
jobs: | ||
release: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- uses: actions/checkout@v4 | ||
with: | ||
ref: latex | ||
fetch-depth: 0 | ||
token: ${{ secrets.PROJECT_TOKEN }} | ||
- name: Modify for next release | ||
run: | | ||
cd react-native | ||
npm i | ||
chmod +x release.sh | ||
./release.sh ${{ env.NEW_VERSION }} ${{ env.NEW_VERSION_CODE }} | ||
git diff | ||
git config user.name '${{ vars.USER_NAME }}' | ||
git config user.email '${{ vars.USER_EMAIL }}' | ||
git add . | ||
git commit -m 'release: SwiftChat v${{ env.NEW_VERSION }}' | ||
git push | ||
git tag ${{ env.NEW_VERSION }} | ||
git push origin ${{ env.NEW_VERSION }} | ||
- name: Prepare release file | ||
run: | | ||
cd react-native/android | ||
ls | ||
./gradlew assembleRelease | ||
cd app/build/outputs/apk/release | ||
ls | ||
- name: Create GitHub release | ||
uses: softprops/action-gh-release@v1 | ||
with: | ||
name: "SwiftChat v${{ env.NEW_VERSION }}" | ||
files: | | ||
*.apk | ||
tag_name: "${{ env.NEW_VERSION }}" | ||
prerelease: false | ||
generate_release_notes: true |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
#!/bin/bash | ||
|
||
version="$1" | ||
version_code="$2" | ||
echo ${version} | ||
echo ${version_code} | ||
regex="[0-9]\+\.[0-9]\+\.[0-9]\+" | ||
version_code_regex="[0-9]\+" | ||
|
||
# modify react native project version | ||
sed -i "s/\"version\": \"${regex}\"/\"version\": \"${version}\"/g" package.json | ||
|
||
# modify android version | ||
sed -i "s/versionCode ${version_code_regex}/versionCode ${version_code}/g" android/app/build.gradle | ||
sed -i "s/versionName \"${regex}\"/versionName \"${version}\"/g" android/app/build.gradle | ||
|
||
# modify iOS version | ||
sed -i "s/MARKETING_VERSION = ${regex};/MARKETING_VERSION = ${version};/g" ios/SwiftChat.xcodeproj/project.pbxproj | ||
sed -i "s/CURRENT_PROJECT_VERSION = ${version_code_regex};/CURRENT_PROJECT_VERSION = ${version_code};/g" ios/SwiftChat.xcodeproj/project.pbxproj | ||
|
||
# modify README download link | ||
sed -i "s/download\/${regex}\/SwiftChat.apk/download\/${version}\/SwiftChat.apk/g" ../README.md | ||
sed -i "s/download\/${regex}\/SwiftChat.dmg/download\/${version}\/SwiftChat.dmg/g" ../README.md | ||
sed -i "s/download\/${regex}\/SwiftChat.apk/download\/${version}\/SwiftChat.apk/g" ../README_CN.md | ||
sed -i "s/download\/${regex}\/SwiftChat.dmg/download\/${version}\/SwiftChat.dmg/g" ../README_CN.md | ||
|
||
|