forked from casdoor/casdoor-authenticator
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
chore: Update GitHub Actions workflow for building and archiving iOS app
- Loading branch information
Showing
2 changed files
with
171 additions
and
101 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 |
---|---|---|
@@ -1,114 +1,114 @@ | ||
name: EAS Build and Release | ||
# name: EAS Build and Release | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
branches: | ||
- master | ||
# 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 | ||
# 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@v4 | ||
with: | ||
distribution: 'temurin' | ||
java-version: '21' | ||
- name: Setup Node.js | ||
uses: actions/setup-node@v4 | ||
with: | ||
node-version: 20.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 | ||
# steps: | ||
# - name: Checkout code | ||
# uses: actions/checkout@v4 | ||
# - name: Setup JDK 21 | ||
# if: matrix.platform == 'android' | ||
# uses: actions/setup-java@v4 | ||
# with: | ||
# distribution: 'temurin' | ||
# java-version: '21' | ||
# - name: Setup Node.js | ||
# uses: actions/setup-node@v4 | ||
# with: | ||
# node-version: 20.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 casdoor-app-ios-${{ matrix.build }}.ipa Payload/ | ||
# - 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 casdoor-app-ios-${{ matrix.build }}.ipa Payload/ | ||
|
||
- name: Upload iOS build artifacts | ||
uses: actions/upload-artifact@v4 | ||
if: matrix.platform == 'ios' | ||
with: | ||
name: casdoor-app-ios-${{ matrix.build }} | ||
path: casdoor-app-ios-${{ matrix.build }}.ipa | ||
# - name: Upload iOS build artifacts | ||
# uses: actions/upload-artifact@v4 | ||
# if: matrix.platform == 'ios' | ||
# with: | ||
# name: casdoor-app-ios-${{ matrix.build }} | ||
# path: casdoor-app-ios-${{ matrix.build }}.ipa | ||
|
||
- name: Archive Android build artifacts | ||
if: matrix.platform == 'android' | ||
run: | | ||
mv $(find . -name "*.apk" | head -n 1) casdoor-app-android-${{ matrix.build }}.apk | ||
# - name: Archive Android build artifacts | ||
# if: matrix.platform == 'android' | ||
# run: | | ||
# mv $(find . -name "*.apk" | head -n 1) casdoor-app-android-${{ matrix.build }}.apk | ||
|
||
- name: Upload Android build artifacts | ||
if: matrix.platform == 'android' | ||
uses: actions/upload-artifact@v4 | ||
with: | ||
name: casdoor-app-android-${{ matrix.build }} | ||
path: casdoor-app-android-${{ matrix.build }}.apk | ||
# - name: Upload Android build artifacts | ||
# if: matrix.platform == 'android' | ||
# uses: actions/upload-artifact@v4 | ||
# with: | ||
# name: casdoor-app-android-${{ matrix.build }} | ||
# path: casdoor-app-android-${{ matrix.build }}.apk | ||
|
||
semantic-release: | ||
needs: build | ||
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 | ||
# semantic-release: | ||
# needs: build | ||
# 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 iOS build artifacts (development) | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: casdoor-app-ios-development | ||
path: release/ios/ | ||
# - name: Download iOS build artifacts (development) | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: casdoor-app-ios-development | ||
# path: release/ios/ | ||
|
||
- name: Download iOS build artifacts (production) | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: casdoor-app-ios-production | ||
path: release/ios/ | ||
# - name: Download iOS build artifacts (production) | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: casdoor-app-ios-production | ||
# path: release/ios/ | ||
|
||
- name: Download Android build artifacts (development) | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: casdoor-app-android-development | ||
path: release/android/ | ||
# - name: Download Android build artifacts (development) | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: casdoor-app-android-development | ||
# path: release/android/ | ||
|
||
- name: Download Android build artifacts (production) | ||
uses: actions/download-artifact@v4 | ||
with: | ||
name: casdoor-app-android-production | ||
path: release/android/ | ||
# - name: Download Android build artifacts (production) | ||
# uses: actions/download-artifact@v4 | ||
# with: | ||
# name: casdoor-app-android-production | ||
# path: release/android/ | ||
|
||
- name: Run semantic-release | ||
run: npm run release | ||
env: | ||
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | ||
# - name: Run semantic-release | ||
# run: npm run release | ||
# env: | ||
# GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
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,70 @@ | ||
on: | ||
push: | ||
branches: [master] | ||
pull_request: | ||
types: [opened, synchronize] | ||
|
||
|
||
jobs: | ||
buildIPA: | ||
runs-on: macos-14 | ||
name: build IPA | ||
permissions: | ||
contents: write | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Get branch name | ||
run: | | ||
# Short name for current branch. For PRs, use target branch (base ref) | ||
GIT_BRANCH=${GITHUB_BASE_REF:-${GITHUB_REF#refs/heads/}} | ||
echo "GIT_BRANCH=$GIT_BRANCH" >> $GITHUB_ENV | ||
- name: Get current date | ||
id: date | ||
run: echo "date=$(date +'%Y-%m-%d')" >> $GITHUB_OUTPUT | ||
|
||
- name: set up JDK 18 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: 18 | ||
distribution: temurin | ||
|
||
- name: Set up Node.js | ||
uses: actions/setup-node@v3 | ||
with: | ||
node-version: '20' | ||
|
||
- name: Get Recent Commit Tag | ||
id: get_commit_tag | ||
run: | | ||
COMMIT_TAG=$(git describe --tags --abbrev=0) | ||
echo "COMMIT_TAG=${COMMIT_TAG}" >> $GITHUB_ENV | ||
- name: Display Commit Tag | ||
run: | | ||
echo "Commit Tag: $COMMIT_TAG" | ||
- name: Install dependencies | ||
run: npm install && npx expo prebuild --platform ios | ||
|
||
- name: Pod Install | ||
run: cd ios && rm Podfile.lock && pod install --repo-update | ||
|
||
- name: build | ||
run: cd ios && xcodebuild -scheme casdoorapp -workspace casdoorapp.xcworkspace -configuration Release clean archive -archivePath "build/casdoorapp.xcarchive" CODE_SIGN_IDENTITY="" CODE_SIGNING_REQUIRED=NO CODE_SIGNING_ALLOWED=NO | ||
|
||
- name: archive to ipa | ||
run: | | ||
cd ios | ||
mkdir build/Payload | ||
mv build/casdoorapp.xcarchive/Products/Applications/casdoorapp.app build/Payload/casdoorapp.app | ||
cd build | ||
zip -r APM.ipa Payload/ | ||
- name: Update artifact | ||
uses: actions/upload-artifact@v2 | ||
with: | ||
name: casdoorapp.ipa | ||
path: ios/build/casdoorapp.ipa |