Skip to content

Commit

Permalink
feat: add semantic release (#17)
Browse files Browse the repository at this point in the history
* feat: add semantic release

* feat: update installation instructions and build steps

* feat: remove ios build
  • Loading branch information
IZUMI-Zu authored Aug 4, 2024
1 parent 02741fa commit a1d6c70
Show file tree
Hide file tree
Showing 5 changed files with 211 additions and 13 deletions.
12 changes: 12 additions & 0 deletions .github/semantic.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Always validate the PR title AND all the commits
titleAndCommits: true
# Require at least one commit to be valid
# this is only relevant when using commitsOnly: true or titleAndCommits: true,
# which validate all commits by default
anyCommit: true
# Allow use of Merge commits (eg on github: "Merge branch 'master' into feature/ride-unicorns")
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
allowMergeCommits: false
# Allow use of Revert commits (eg on github: "Revert "feat: ride unicorns"")
# this is only relevant when using commitsOnly: true (or titleAndCommits: true)
allowRevertCommits: false
62 changes: 62 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
name: Build and Release

on:
workflow_dispatch:
push:
branches:
- master
pull_request:
branches:
- master

jobs:
build-apk:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4

- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: '20'

- name: set up JDK 18
uses: actions/setup-java@v4
with:
java-version: 18
distribution: temurin

- name: Install npm dependencies
run: |
npm install && npx expo prebuild --platform android
- name: Build Android Release
run: |
cd android && ./gradlew assembleRelease
mv app/build/outputs/apk/release/app-release.apk app/build/outputs/apk/release/casdoorapp.apk
- name: Upload Artifact
uses: actions/upload-artifact@v4
with:
name: casdoorapp.apk
path: android/app/build/outputs/apk/release/

semantic-release:
needs: [build-apk]
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: 20.x

- name: Download Android build artifacts
uses: actions/download-artifact@v4
with:
name: casdoorapp.apk
path: release/android/

- name: Run semantic-release
run: npm run release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
29 changes: 29 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,35 @@ cd casdoor-app
npm install && npm run start
```

## Installation

You can download the latest version of the Casdoor Authenticator App from the GitHub Releases page.

- Android: Download and install the APK file directly on your device.

### Building from Source

If you prefer to build the app yourself, follow these steps:

### Common Steps

```bash
git clone [email protected]:casdoor/casdoor-app.git
cd casdoor-app
npm install
```

### android build

```bash
npm install && npx expo prebuild --platform android
cd android && ./gradlew assembleRelease
```

The APK file in the `app/build/outputs/apk/release/` directory.

Note: You'll need to have the necessary development environments set up for React Native, Android. Refer to the React Native documentation for detailed setup instructions.

## Usage

- Open the app on your mobile device.
Expand Down
66 changes: 54 additions & 12 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

55 changes: 54 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,12 @@
"start": "expo start",
"android": "expo start --android",
"ios": "expo start --ios",
"web": "expo start --web"
"web": "expo start --web",
"release": "npx -p semantic-release-expo -p semantic-release -p @semantic-release/git -p @semantic-release/changelog -p @semantic-release/exec semantic-release"
},
"dependencies": {
"@react-native-async-storage/async-storage": "1.23.1",
"@react-native-community/masked-view": "^0.1.11",
"@react-native-community/netinfo": "11.3.1",
"@react-navigation/bottom-tabs": "^6.5.8",
"@react-navigation/native": "^6.1.7",
Expand All @@ -19,6 +22,7 @@
"expo-dev-client": "^4.0.21",
"expo-image": "^1.12.13",
"expo-status-bar": "~1.12.1",
"expo-system-ui": "~3.0.7",
"expo-updates": "~0.25.21",
"hotp-totp": "^1.0.6",
"prop-types": "^15.8.1",
Expand All @@ -28,12 +32,61 @@
"react-native-countdown-circle-timer": "^3.2.1",
"react-native-gesture-handler": "~2.16.1",
"react-native-paper": "^5.10.3",
"react-native-reanimated": "~3.10.1",
"react-native-root-toast": "^3.6.0",
"react-native-safe-area-context": "4.10.5",
"react-native-screens": "^3.31.1",
"react-native-svg": "15.2.0",
"react-native-web": "~0.19.6",
"react-native-webview": "13.8.6",
"totp-generator": "^0.0.14"
},
"verifyConditions": [
"semantic-release-expo",
"@semantic-release/changelog",
"@semantic-release/git"
],
"release": {
"branches": [
"master"
],
"plugins": [
[
"semantic-release-expo",
{
"versions": {
"version": "${next.raw}",
"android": "${code}",
"ios": "${next.raw}"
}
}
],
"@semantic-release/commit-analyzer",
"@semantic-release/release-notes-generator",
[
"@semantic-release/git",
{
"assets": [
"package.json",
"package-lock.json",
"app.json"
],
"message": "chore(release): ${nextRelease.version} [skip ci]"
}
],
[
"@semantic-release/github",
{
"assets": [
{
"path": "release/android/*.apk",
"label": "Android"
}
]
}
]
]
},
"devDependencies": {
"@babel/core": "^7.24.0",
"@babel/eslint-parser": "^7.18.9",
Expand Down

0 comments on commit a1d6c70

Please sign in to comment.