# Github Action

Source: https://help.testapp.io/github-action/

GitHub Actions makes it easy to **automate all your software workflows** with world-class CI/CD. Build, test, and deploy your code right from GitHub.

Adding our [GitHub Action](https://github.com/marketplace/actions/testapp-io-app-distribution) to your repo will automatically upload the APK or IPA to [TestApp.io](https://testapp.io/) and notify your testers.

![TestApp.io GitHub Action running](https://f000.backblazeb2.com/file/help-testappio/2022/03/testapp.io-github-action-running_o.png)

*TestApp.io GitHub Action for Linux and macOS*

This action uploads artifacts (.apk or .ipa) to TestApp.io and notifies your team members.

```yaml
- name: TestApp.io App Distribution
  uses: testappio/github-action@v5
```

[Get it from GitHub Actions Marketplace](https://github.com/marketplace/actions/testapp-io-app-distribution)

---

## Requirements

This action will **execute on runners with Ubuntu & macOS operating systems**.

## Configuration

| Key | Description | Env Var | Default |
| --- | --- | --- | --- |
| `api_token` | You can get it from [portal.testapp.io/profile/tokens](https://portal.testapp.io/profile/tokens) | `TESTAPPIO_API_TOKEN` |  |
| `app_id` | You can get it from your app page at [portal.testapp.io/apps](https://portal.testapp.io/apps) → Integrations tab | `TESTAPPIO_APP_ID` |  |
| `release` | It can be either `both`, `android`, or `ios` | `TESTAPPIO_RELEASE` |  |
| `file` | Path to the Android .APK or iOS .IPA file | `TESTAPPIO_ANDROID_PATH` |  |
| `release_notes` | Manually add the release notes to be displayed for the testers | `TESTAPPIO_RELEASE_NOTES` |  |
| `git_release_notes` | Collect release notes from the latest git commit message: `true` or `false` | `TESTAPPIO_GIT_RELEASE_NOTES` | `true` |
| `include_git_commit_id` | Include the last commit ID in the release notes: `true` or `false` | `TESTAPPIO_GIT_COMMIT_ID` | `false` |
| `notify` | Send notifications to your team members about this release: `true` or `false` | `TESTAPPIO_NOTIFY` | `false` |

*Check* [*ta-cli*](https://help.testapp.io/ta-cli/) *for more info*

---

## Sample Usage for Android

```yaml
name: Upload APK to TestApp.io

on:
  push:
    branches:
      - main

jobs:
  android:
    runs-on: ubuntu-latest
    steps:
      - name: Checkout
        uses: actions/checkout@v4

      - name: Set up JDK 17
        uses: actions/setup-java@v4
        with:
          distribution: 'temurin'
          java-version: '17'

      - name: Build debug APK
        run: ./gradlew assembleDebug

      - name: Upload to TestApp.io
        uses: testappio/github-action@v5
        with:
          api_token: ${{ secrets.TESTAPPIO_API_TOKEN }}
          app_id: ${{ secrets.TESTAPPIO_APP_ID }}
          file: app/build/outputs/apk/debug/app-debug.apk
          release_notes: ""
          git_release_notes: true
          include_git_commit_id: false
          notify: true
```

If you want a release build instead, replace:

```yaml
      - name: Build release APK
        run: ./gradlew assembleRelease
```

```yaml
          file: app/build/outputs/apk/release/app-release.apk
```

---

## Sample Usage for iOS

```yaml
name: Upload IPA to TestApp.io

on:
  push:
    branches:
      - main

jobs:
  ios:
    runs-on: macos-latest
    steps:
      - name: Checkout repository
        uses: actions/checkout@v4

      - name: Build and export iOS
        uses: yukiarrr/ios-build-action@v1.12.0
        with:
          project-path: ios/YourApp.xcodeproj
          workspace-path: ios/YourApp.xcworkspace
          scheme: YourApp
          export-method: ad-hoc
          configuration: Release
          output-path: artifacts/output.ipa
          p12-base64: ${{ secrets.P12_BASE64 }}
          certificate-password: ${{ secrets.P12_PASSWORD }}
          mobileprovision-base64: ${{ secrets.ADHOC_MOBILEPROVISION_BASE64 }}
          code-signing-identity: ${{ secrets.CODE_SIGNING_IDENTITY }}
          team-id: ${{ secrets.TEAM_ID }}

      - name: Upload to TestApp.io
        uses: testappio/github-action@v5
        with:
          api_token: ${{ secrets.TESTAPPIO_API_TOKEN }}
          app_id: ${{ secrets.TESTAPPIO_APP_ID }}
          file: artifacts/output.ipa
          release_notes: ""
          git_release_notes: true
          include_git_commit_id: false
          notify: true
```

More info about the iOS build & export action: [yukiarrr/ios-build-action](https://github.com/yukiarrr/ios-build-action)

---

## Install

```yaml
- name: TestApp.io App Distribution
  uses: testappio/github-action@v5
```

[Get it from GitHub Actions Marketplace](https://github.com/marketplace/actions/testapp-io-app-distribution)

---

#### Related Articles

- [GitHub Actions with Fastlane Plugin](https://help.testapp.io/github-action-with-fastlane-plugin/)
- [Setup iOS Project for Fastlane](https://help.testapp.io/setup-ios-project-for-fastlane/)
- [ta-cli Documentation](https://help.testapp.io/ta-cli/)
- [ta-cli on GitHub](https://github.com/testappio/cli)

---

Need help? [Contact us](https://testapp.io/contact-us/). we're happy to assist!
