Skip to content

Commit

Permalink
Add GitHub actions (#20)
Browse files Browse the repository at this point in the history
  • Loading branch information
zsmb13 authored Jul 23, 2024
1 parent a671b54 commit ce2470b
Show file tree
Hide file tree
Showing 3 changed files with 88 additions and 0 deletions.
24 changes: 24 additions & 0 deletions .github/workflows/build-android.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
name: Build Android app

on:
push:
branches:
- main
pull_request:

jobs:
test:
name: Build
runs-on: macOS-latest
# Only run build in template repo
if: github.event.repository.name == 'KMP-App-Template' && github.repository_owner == 'Kotlin'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Android debug build
run: ./gradlew assembleDebug --stacktrace
26 changes: 26 additions & 0 deletions .github/workflows/build-ios.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
name: Build iOS app

on:
push:
branches:
- main
pull_request:

jobs:
test:
name: Build
runs-on: macOS-latest
# Only run build in template repo
if: github.event.repository.name == 'KMP-App-Template' && github.repository_owner == 'Kotlin'
steps:
- name: Check out code
uses: actions/checkout@v4
- name: Set up JDK 21
uses: actions/setup-java@v4
with:
distribution: 'zulu'
java-version: 21
- name: Set Xcode version
run: sudo xcode-select -s /Applications/Xcode_15.3.app/Contents/Developer
- name: iOS debug build
run: cd iosApp && xcodebuild -scheme iosApp -configuration Debug -destination 'platform=iOS Simulator,OS=latest,name=iPhone 15' CODE_SIGNING_ALLOWED='NO'
38 changes: 38 additions & 0 deletions .github/workflows/template-cleanup.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
# GitHub Actions Workflow responsible for cleaning up the template repository from
# template-specific files. This workflow is supposed to be triggered automatically
# when a new template-based repository has been created.

name: Template Cleanup
on:
push:
branches:
- main

jobs:
# Run cleaning process only if workflow is triggered by the non-Kotlin/KMP-App-Template repository.
template-cleanup:
name: Template Cleanup
runs-on: ubuntu-latest
if: github.event.repository.name != 'KMP-App-Template' || github.repository_owner != 'Kotlin'
permissions:
contents: write
steps:
- name: Fetch Sources
uses: actions/checkout@v2

- name: Cleanup
run: |
rm -rf .github
- name: Commit files
run: |
git config --local user.email "action@github.com"
git config --local user.name "GitHub Action"
git add .
git commit -m "Clean up template"
- name: Push changes
uses: ad-m/github-push-action@master
with:
branch: main
github_token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit ce2470b

Please sign in to comment.