feat: add auto release and preview ci #6
Workflow file for this run
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
name: EAS Build and Release | |
on: | |
workflow_dispatch: | |
push: | |
branches: | |
- master | |
pull_request: | |
branches: | |
- master | |
jobs: | |
build: | |
runs-on: ${{ matrix.os }} | |
strategy: | |
matrix: | |
os: [macos-latest, ubuntu-latest] | |
build: [development, production] | |
include: | |
- os: macos-latest | |
platform: ios | |
- os: ubuntu-latest | |
platform: android | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup JDK 21 | |
if: matrix.platform == 'android' | |
uses: actions/setup-java@v2 | |
with: | |
distribution: 'temurin' | |
java-version: '21' | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: 18.x | |
cache: npm | |
- name: Setup Expo and EAS | |
uses: expo/expo-github-action@v8 | |
with: | |
eas-version: latest | |
token: ${{ secrets.EXPO_TOKEN }} | |
- name: Install dependencies | |
run: npm ci | |
- name: Build Locally | |
run: eas build --profile ${{ matrix.build }} --platform ${{ matrix.platform }} --no-wait --non-interactive --local | |
- name: Archive iOS build artifacts | |
if: matrix.platform == 'ios' | |
run: | | |
tar -xzvf build-*.tar.gz | |
mkdir -p Payload | |
mv $(find . -name "*.app" | head -n 1) Payload/casdoorapp.app | |
zip -r casdoorapp.ipa Payload/ | |
- name: Upload iOS build artifacts | |
uses: actions/upload-artifact@v2 | |
if: matrix.platform == 'ios' | |
with: | |
name: casdoor-app-ios-${{ matrix.build }} | |
path: casdoorapp.ipa | |
- name: Upload Android build artifacts | |
if: matrix.platform == 'android' | |
uses: actions/upload-artifact@v2 | |
with: | |
name: casdoor-app-android-${{ matrix.build }} | |
path: $(find . -name "*.apk" | head -n 1) | |
semantic-release: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 20.x | |
- name: Create Release Directory | |
run: mkdir -p release | |
- name: Download iOS build artifacts (development) | |
uses: actions/download-artifact@v2 | |
with: | |
name: casdoor-app-ios-development | |
path: release/ios/development | |
- name: Download iOS build artifacts (production) | |
uses: actions/download-artifact@v2 | |
with: | |
name: casdoor-app-ios-production | |
path: release/ios/production | |
- name: Download Android build artifacts (development) | |
uses: actions/download-artifact@v2 | |
with: | |
name: casdoor-app-android-development | |
path: release/android/development | |
- name: Download Android build artifacts (production) | |
uses: actions/download-artifact@v2 | |
with: | |
name: casdoor-app-android-production | |
path: release/android/production | |
- name: Run semantic-release | |
run: npm run release | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |