Files
lunasea/.github/workflows/publish.yml
2022-04-03 21:50:57 -04:00

289 lines
9.6 KiB
YAML

name: 'Publish Releases'
on:
workflow_call:
inputs:
flavor:
required: true
type: string
build-title:
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_ID:
required: true
APPLE_TEAM_ID:
required: true
DISCORD_WEBHOOK_EDGE:
required: true
DISCORD_WEBHOOK_BETA:
required: true
DISCORD_WEBHOOK_CANDIDATE:
required: true
DISCORD_WEBHOOK_STABLE:
required: true
GOOGLE_PLAY_API:
required: true
NETLIFY_AUTH_TOKEN:
required: true
SNAPCRAFT_TOKEN:
required: true
S3_ACCESS_KEY:
required: true
S3_BUCKET:
required: true
S3_ENDPOINT:
required: true
S3_KEY_ID:
required: true
S3_REGION:
required: true
jobs:
android-play-store:
name: Play Store
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: play-store
google-play-key: ${{ secrets.GOOGLE_PLAY_API }}
- name: Download Play Store Package
uses: actions/download-artifact@v3
with:
name: android-playstore-package
path: ${{ github.workspace }}/output
- name: Determine Release Channel
id: channel
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.flavor }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || 'edge';
switch (ref) {
case 'beta': return 'alpha';
case 'candidate': return 'beta';
case 'stable': return 'production';
case 'edge':
default: return 'internal';
}
- name: Deploy to Google Play Store
working-directory: ${{ github.workspace }}/android
env:
SUPPLY_JSON_KEY: ${{ github.workspace }}/keys/googleplay.json
run: bundle exec fastlane deploy_playstore track:${{ steps.channel.outputs.result }} aab:${{ github.workspace }}/output/LunaSea-Android.aab version_name:${{ inputs.build-title }}
ios-app-store:
name: App Store (iOS)
runs-on: macos-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: app-store
appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }}
- name: Download App Store Package
uses: actions/download-artifact@v3
with:
name: ios-appstore-package
path: ${{ github.workspace }}/output
- name: Deploy to App Store Connect
working-directory: ${{ github.workspace }}/ios
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: ${{ github.workspace }}/keys/appstore.p8
APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: bundle exec fastlane deploy_appstore groups:${{ inputs.flavor }} ipa:${{ github.workspace }}/output/LunaSea-iOS.ipa
linux-snapcraft:
name: Snapcraft
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: snapcraft
snapcraft-token: ${{ secrets.SNAPCRAFT_TOKEN }}
- name: Download Snap
uses: actions/download-artifact@v3
with:
name: linux-snapcraft
path: ${{ github.workspace }}/output
- name: Deploy to Snapcraft
run: snapcraft upload --release=${{ inputs.flavor }} ${{ github.workspace }}/output/LunaSea-Linux-amd64.snap
macos-appstore:
name: App Store (macOS)
runs-on: macos-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: app-store
appstore-connect-key: ${{ secrets.APPLE_STORE_CONNECT_KEY }}
- name: Download App Store Package
uses: actions/download-artifact@v3
with:
name: macos-appstore-package
path: ${{ github.workspace }}/output
- 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: ${{ github.workspace }}/keys/appstore.p8
APPLE_STORE_CONNECT_KEY_ID: ${{ secrets.APPLE_STORE_CONNECT_KEY_ID }}
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: bundle exec fastlane deploy_appstore groups:${{ inputs.flavor }} pkg:${{ github.workspace }}/output/LunaSea-macOS.pkg
web-netlify:
name: Netlify
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: netlify
- name: Download Web Package
uses: actions/download-artifact@v3
with:
name: web-canvaskit
path: ${{ github.workspace }}/output
- name: Determine Release Channel
id: channel
uses: actions/github-script@v6
env:
FLAVOR: ${{ inputs.flavor }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || 'edge';
switch (ref) {
case 'beta': return '11ef2676-fc31-41b5-897b-fd21273d87ed';
case 'candidate': return '4636e6a1-17ef-45a2-a2b6-3d1c166fd1df';
case 'stable': return '6634f0b1-323c-4a2f-bd0b-8f1f388673a9';
case 'edge':
default: return '325e197e-55f4-449a-b2bb-6831fe47bf2a';
}
- name: Deploy to Netlify
uses: nwtgck/actions-netlify@v1.2
env:
NETLIFY_AUTH_TOKEN: ${{ secrets.NETLIFY_AUTH_TOKEN }}
NETLIFY_SITE_ID: ${{ steps.channel.outputs.result }}
with:
publish-dir: ${{ github.workspace}}/output
production-deploy: true
deploy-message: ${{ inputs.build-title }}
s3:
name: S3
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: s3
- name: Download Android App Package
uses: actions/download-artifact@v3
with:
name: android-app-package
path: ${{ github.workspace }}/output
- name: Download iOS App Package
uses: actions/download-artifact@v3
with:
name: ios-appstore-package
path: ${{ github.workspace }}/output
- name: Download Linux Snap
uses: actions/download-artifact@v3
with:
name: linux-snapcraft
path: ${{ github.workspace }}/output
- name: Download macOS App Package
uses: actions/download-artifact@v3
with:
name: macos-app-package
path: ${{ github.workspace }}/output
- name: Download macOS Disk Image
uses: actions/download-artifact@v3
with:
name: macos-disk-image
path: ${{ github.workspace }}/output
- name: Upload to S3 Bucket
uses: jakejarvis/s3-sync-action@v0.5.1
with:
args: --acl public-read --follow-symlinks
env:
AWS_ACCESS_KEY_ID: ${{ secrets.S3_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.S3_ACCESS_KEY }}
AWS_S3_BUCKET: ${{ secrets.S3_BUCKET }}
AWS_S3_ENDPOINT: ${{ secrets.S3_ENDPOINT }}
AWS_REGION: ${{ secrets.S3_REGION }}
SOURCE_DIR: ${{ github.workspace }}/output
DEST_DIR: ${{ inputs.build-title }}
- name: Determine Webhook Channel
id: webhook
uses: actions/github-script@v6
env:
DISCORD_WEBHOOK_EDGE: ${{ secrets.DISCORD_WEBHOOK_EDGE }}
DISCORD_WEBHOOK_BETA: ${{ secrets.DISCORD_WEBHOOK_BETA }}
DISCORD_WEBHOOK_CANDIDATE: ${{ secrets.DISCORD_WEBHOOK_CANDIDATE }}
DISCORD_WEBHOOK_STABLE: ${{ secrets.DISCORD_WEBHOOK_STABLE }}
FLAVOR: ${{ inputs.flavor }}
with:
result-encoding: string
script: |
const ref = process.env.FLAVOR || 'edge';
switch (ref) {
case 'beta': return process.env.DISCORD_WEBHOOK_BETA;
case 'candidate': return process.env.DISCORD_WEBHOOK_CANDIDATE;
case 'stable': return process.env.DISCORD_WEBHOOK_STABLE;
case 'edge':
default: return process.env.DISCORD_WEBHOOK_EDGE;
}
- name: Send Discord Message
uses: sarisia/actions-status-discord@v1
with:
webhook: ${{ steps.webhook.outputs.result }}
username: LunaSea Support
avatar_url: https://raw.githubusercontent.com/JagandeepBrar/LunaSea/master/assets/icon/icon.png
noprefix: true
color: 0x4ECCA3
title: ${{ inputs.build-title }}
description: '[Download](https://builds.lunasea.app/#${{ inputs.build-title }}/)'