Files
lunasea/.github/workflows/release_macos.yml
2022-03-31 16:16:48 -04:00

182 lines
5.4 KiB
YAML

name: '[Release] macOS'
on:
workflow_call:
inputs:
build_flavor:
required: true
type: string
build_number:
required: true
type: string
secrets:
APPLE_ID:
required: true
APPLE_ITC_TEAM_ID:
required: true
APPLE_STORE_CONNECT_ISSUER_ID:
required: true
APPLE_STORE_CONNECT_KEY:
required: true
APPLE_STORE_CONNECT_KEY_FILEPATH:
required: true
APPLE_STORE_CONNECT_KEY_ID:
required: true
APPLE_TEAM_ID:
required: true
DISCORD_WEBHOOK:
required: true
FIREBASE_OPTIONS:
required: true
MATCH_KEYCHAIN_NAME:
required: true
MATCH_KEYCHAIN_PASSWORD:
required: true
MATCH_PASSWORD:
required: true
MATCH_SSH_PRIVATE_KEY:
required: true
jobs:
build:
name: Build
runs-on: macos-latest
steps:
- name: Checkout Repository
uses: actions/checkout@v2
with:
fetch-depth: 0
- name: Download Source Files
uses: actions/download-artifact@v2
with:
name: lib-${{ github.sha }}
path: ${{ github.workspace }}/lib
- name: Download Localization Files
uses: actions/download-artifact@v2
with:
name: localization-${{ github.sha }}
path: ${{ github.workspace }}/assets/localization
- name: Select Xcode Version
uses: maxim-lobanov/setup-xcode@v1
with:
xcode-version: latest-stable
- name: Install Secrets
working-directory: ${{ github.workspace }}
run: |
echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart
- name: Setup SSH Agent
uses: webfactory/ssh-agent@v0.5.4
with:
ssh-private-key: ${{ secrets.MATCH_SSH_PRIVATE_KEY }}
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Install Flutter
uses: subosito/flutter-action@v2
with:
channel: stable
cache: true
cache-key: ${{ github.sha }}
- name: Setup Flutter
working-directory: ${{ github.workspace }}
run: |
flutter config --enable-macos-desktop
flutter pub get
- name: Install Pods
working-directory: ${{ github.workspace }}/macos
run: |
pod install --repo-update
- name: Run Fastlane
working-directory: ${{ github.workspace }}/macos
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
MATCH_KEYCHAIN_NAME: ${{ secrets.MATCH_KEYCHAIN_NAME }}
MATCH_KEYCHAIN_PASSWORD: ${{ secrets.MATCH_KEYCHAIN_PASSWORD }}
MATCH_PASSWORD: ${{ secrets.MATCH_PASSWORD }}
run: |
bundle install
bundle exec fastlane build build_number:${{ inputs.build_number }}
- name: Upload App Package Artifact
uses: actions/upload-artifact@v2
with:
name: macos-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}/macos/LunaSea.pkg
- name: Send Discord Message
uses: sarisia/actions-status-discord@v1
if: always()
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
with:
title: '`[${{ inputs.build_flavor }}]` macOS Build'
description: macos-${{ inputs.build_flavor }}-${{ github.sha }}
deploy:
name: Deploy
runs-on: macos-latest
needs: [ build ]
steps:
- name: Checkout Repository
uses: actions/checkout@v2
- name: Determine Release Channel
id: channel
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.ref }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || "edge";
switch (ref) {
case "beta": return "beta";
case "candidate": return "candidate";
case "stable": return "stable";
case "edge":
default: return "edge";
}
- name: Download App Package Artifact
uses: actions/download-artifact@v2
with:
name: macos-${{ inputs.build_flavor }}-${{ github.sha }}
path: ${{ github.workspace }}
- name: Install Secret Keys
working-directory: ${{ github.workspace }}
run: |
echo ${{ secrets.APPLE_STORE_CONNECT_KEY }} | base64 --decode > macos/${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }}
- name: Install Ruby
uses: ruby/setup-ruby@v1
with:
bundler-cache: true
- name: Deploy to App Store Connect
working-directory: ${{ github.workspace }}/macos
env:
APPLE_ID: ${{ secrets.APPLE_ID }}
APPLE_ITC_TEAM_ID: ${{ secrets.APPLE_ITC_TEAM_ID }}
APPLE_STORE_CONNECT_ISSUER_ID: ${{ secrets.APPLE_STORE_CONNECT_ISSUER_ID }}
APPLE_STORE_CONNECT_KEY_FILEPATH: ${{ secrets.APPLE_STORE_CONNECT_KEY_FILEPATH }}
APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: |
bundle install
bundle exec fastlane deploy groups:${{ steps.channel.outputs.result }} pkg:${{ github.workspace }}/LunaSea.pkg