Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Review and refactor before widespread usage + add USING.md #6

Merged
merged 4 commits into from
Nov 10, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
name: 'Test Preternatural Build Action'
on:
pull_request:
branches: [ main ]

jobs:
test-swift-package:
runs-on: ghcr.io/cirruslabs/macos-runner:sonoma
steps:
- name: Test Swift Package Basic Functionality
uses: tahabebek/MockPackage/BuildAction@main
with:
path: ${{ github.sha }}
58 changes: 18 additions & 40 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,53 +2,31 @@

This repository contains GitHub Actions for use with [Preternatural CLI](https://github.com/PreternaturalAI/CLI-release).

## Actions

## Preternatural Build Action

This action allows you to run the Preternatural CLI build command on your repositories with support for a specific Xcode version.

### Inputs

- `xcode-version`: (Required) Xcode version to use.
- `derived_data_path`: (Optional) The path to the derived data folder.
- `build_all_platforms`: (Optional) Set to `true` to build for all supported platforms. Defaults to `false`.
- `configuration`: (Optional) Build configuration (debug or release). Defaults to `debug`.

#### Example Usage
### 1. Preternatural Build Action
Runs the Preternatural CLI build command on your repositories.

```yaml
name: Run Preternatural Build
uses: PreternaturalAI/github-action/preternatural-build@main
with:
xcode-version: '16'
build_all_platforms: 'false'
derived_data_path: '~/Library/Developer/Xcode/DerivedData'
configuration: 'release'
- uses: PreternaturalAI/preternatural-build-action@v1
```

## Preternatural Archive & Notarize Action
### 2. Preternatural Archive & Notarize Action
Archives and notarizes macOS applications using the Preternatural CLI.

This action allows you to archive and notarize a MacOS application using the Preternatural CLI.
```yaml
- uses: PreternaturalAI/preternatural-archive-action@v1
with:
notarization_username: ${{ secrets.NOTARIZATION_USERNAME }}
notarization_password: ${{ secrets.NOTARIZATION_PASSWORD }}
build_certificate_base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
p12_password: ${{ secrets.P12_PASSWORD }}
```

### Inputs
## Documentation

- `xcode-version`: (Required) Xcode version to use.
- `notarization_username`: (Required) Your Apple ID email.
- `notarization_password`: (Required) App specific password to use for notarization. See [here](https://support.apple.com/en-us/102654) for steps on how to create one.
- `notarization_team_id`: (Optional) App Store Connect Team ID for notarization. If not provided, this will be automatically extracted from the Xcode project. The Team ID provided here should match the Team ID of the certificate.
- `build_certificate_base64`: (Required) Your Apple Developer ID Certificate encoded in base64. Follow the steps in [this tutorial](https://localazy.com/blog/how-to-automatically-sign-macos-apps-using-github-actions) to get the base64 string of your certificate.
- `p12_password`: (Required) Password for the `Developer ID Application` certificate.
See [USING.md](./USING.md) for detailed documentation, examples, and troubleshooting.

#### Example Usage
## License

```yaml
name: Archive and Notarize MacOS App
uses: PreternaturalAI/github-action/preternatural-archive@main
with:
xcode-version: '16'
notarization_username: ${{ secrets.NOTARIZATION_USERNAME }}
notarization_password: ${{ secrets.NOTARIZATION_PASSWORD }}
notarization_team_id: ${{ secrets.NOTARIZATION_TEAM_ID }}
build_certificate_base64: ${{ secrets.BUILD_CERTIFICATE_BASE64 }}
p12_password: ${{ secrets.P12_PASSWORD }}
```
[License Type] - See LICENSE file for details
158 changes: 158 additions & 0 deletions USING.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,158 @@
# Preternatural GitHub Actions Usage Guide

This document catalogs the available Preternatural GitHub Actions and their usage examples.

## Table of Contents
- [Build Action](#build-action)
- [Archive & Notarize Action](#archive--notarize-action)

## Action Source Files

- [Build Action Source](preternatural-build/action.yml) - Implementation of the build action
- [Archive Action Source](preternatural-archive/action.yml) - Implementation of the archive and notarize action

## Build Action

The Build Action runs Preternatural build commands on repositories with specified Xcode configurations.

### Build Action Inputs

| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `xcode-version` | Xcode version to use for building | No | `latest-stable` |
| `platforms` | Target platforms to build for | No | `["macOS"]` |
| `configurations` | Build configurations to use | No | `["debug", "release"]` |
| `derived_data_path` | Path to the derived data folder | No | `DerivedData/ProjectBuild` |

### Build Action Examples

#### Basic Build
```yaml
steps:
- uses: PreternaturalAI/preternatural-build-action@v1
```

#### Multi-Platform Build
```yaml
steps:
- uses: PreternaturalAI/preternatural-build-action@v1
with:
platforms: '["iOS", "macOS", "tvOS"]'
```

#### Debug-Only Build with Custom Derived Data
```yaml
steps:
- uses: PreternaturalAI/preternatural-build-action@v1
with:
configurations: '["debug"]'
derived_data_path: 'CustomDerivedData'
```

#### All Platforms Release Build
```yaml
steps:
- uses: PreternaturalAI/preternatural-build-action@v1
with:
platforms: '["iOS", "macOS", "tvOS", "watchOS", "visionOS"]'
configurations: '["release"]'
```

#### Build with Specific Xcode Version
```yaml
steps:
- uses: PreternaturalAI/preternatural-build-action@v1
with:
xcode-version: '14.3.1'
platforms: '["macOS"]'
```

## Archive & Notarize Action

The Archive & Notarize Action creates and notarizes a macOS application using the Preternatural CLI.

### Archive Action Inputs

| Input | Description | Required | Default |
|-------|-------------|----------|---------|
| `xcode-version` | Xcode version to use | Yes | `latest-stable` |
| `notarization_username` | App Store Connect Username | Yes | - |
| `notarization_password` | App Store Connect Password | Yes | - |
| `notarization_team_id` | App Store Connect Team ID | No | - |
| `build_certificate_base64` | Base64-encoded Apple certificate | Yes | - |
| `p12_password` | Password for the P12 certificate | Yes | - |

### Archive Action Examples

#### Basic Archive and Notarize
```yaml
steps:
- uses: PreternaturalAI/preternatural-archive-action@v1
with:
notarization_username: ${{ secrets.NOTARIZATION_USERNAME }}
notarization_password: ${{ secrets.NOTARIZATION_PASSWORD }}
build_certificate_base64: ${{ secrets.BUILD_CERTIFICATE }}
p12_password: ${{ secrets.P12_PASSWORD }}
```

#### Archive with Team ID and Specific Xcode Version
```yaml
steps:
- uses: PreternaturalAI/preternatural-archive-action@v1
with:
xcode-version: '15.2'
notarization_username: ${{ secrets.NOTARIZATION_USERNAME }}
notarization_password: ${{ secrets.NOTARIZATION_PASSWORD }}
notarization_team_id: 'YOUR_TEAM_ID'
build_certificate_base64: ${{ secrets.BUILD_CERTIFICATE }}
p12_password: ${{ secrets.P12_PASSWORD }}
```

#### Archive with Custom Team Setup
```yaml
steps:
- uses: PreternaturalAI/preternatural-archive-action@v1
with:
xcode-version: '15.2'
notarization_username: ${{ secrets.NOTARIZATION_USERNAME }}
notarization_password: ${{ secrets.NOTARIZATION_PASSWORD }}
notarization_team_id: ${{ secrets.TEAM_ID }}
build_certificate_base64: ${{ secrets.ENTERPRISE_CERTIFICATE }}
p12_password: ${{ secrets.ENTERPRISE_CERT_PASSWORD }}
```

#### Archive for Enterprise Distribution
```yaml
steps:
- uses: PreternaturalAI/preternatural-archive-action@v1
with:
notarization_username: ${{ secrets.ENTERPRISE_USERNAME }}
notarization_password: ${{ secrets.ENTERPRISE_PASSWORD }}
notarization_team_id: ${{ secrets.ENTERPRISE_TEAM_ID }}
build_certificate_base64: ${{ secrets.ENTERPRISE_CERTIFICATE }}
p12_password: ${{ secrets.ENTERPRISE_CERT_PASSWORD }}
```

## Features

### Build Action Features
- Derived data caching
- Detailed build logs
- Multi-platform support
- Various project structure support

### Archive Action Features
- Automatic certificate installation
- Notarization process handling
- Artifact uploading
- Team ID support
- Secure secrets handling

## Requirements

- macOS runner
- GitHub Actions environment
- For notarization:
- Valid Apple Developer account
- App Store Connect credentials
- Valid certificate and provisioning profile
Loading