mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-30 20:24:25 +00:00
206 lines
6.5 KiB
YAML
206 lines
6.5 KiB
YAML
name: Publish S3
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
build-title:
|
|
required: true
|
|
type: string
|
|
flavor:
|
|
required: true
|
|
type: string
|
|
enable-android:
|
|
required: true
|
|
type: string
|
|
enable-ios:
|
|
required: true
|
|
type: string
|
|
enable-linux:
|
|
required: true
|
|
type: string
|
|
enable-macos:
|
|
required: true
|
|
type: string
|
|
enable-web:
|
|
required: true
|
|
type: string
|
|
enable-windows:
|
|
required: true
|
|
type: string
|
|
|
|
secrets:
|
|
DISCORD_WEBHOOK_EDGE:
|
|
required: true
|
|
DISCORD_WEBHOOK_BETA:
|
|
required: true
|
|
DISCORD_WEBHOOK_CANDIDATE:
|
|
required: true
|
|
DISCORD_WEBHOOK_STABLE:
|
|
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:
|
|
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
|
|
if-no-files-found: warn
|
|
|
|
- name: Download iOS App Package
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: ios-appstore-package
|
|
path: ${{ github.workspace }}/output
|
|
if-no-files-found: warn
|
|
|
|
- name: Download Linux Snap
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: linux-snapcraft
|
|
path: ${{ github.workspace }}/output
|
|
if-no-files-found: warn
|
|
|
|
- name: Download macOS App Package
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: macos-app-package
|
|
path: ${{ github.workspace }}/output
|
|
if-no-files-found: warn
|
|
|
|
- name: Download macOS Disk Image
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: macos-disk-image
|
|
path: ${{ github.workspace }}/output
|
|
if-no-files-found: warn
|
|
|
|
- name: Download Windows App Package
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: windows-app-package
|
|
path: ${{ github.workspace }}/output
|
|
if-no-files-found: warn
|
|
|
|
- name: Download Web Archive
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: web-archive
|
|
path: ${{ github.workspace }}/output
|
|
if-no-files-found: warn
|
|
|
|
- name: Download Windows MSIX Installer
|
|
uses: actions/download-artifact@v3
|
|
with:
|
|
name: windows-msix-installer
|
|
path: ${{ github.workspace }}/output
|
|
if-no-files-found: warn
|
|
|
|
- name: Upload to S3 Bucket (Build Title)
|
|
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: Upload to S3 Bucket (Latest)
|
|
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: latest/${{ inputs.flavor }}
|
|
|
|
- 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: Create Discord Message
|
|
id: message
|
|
uses: actions/github-script@v6
|
|
env:
|
|
BUILD_TITLE: ${{ inputs.build-title }}
|
|
ANDROID: ${{ inputs.enable-android }}
|
|
IOS: ${{ inputs.enable-ios }}
|
|
LINUX: ${{ inputs.enable-linux }}
|
|
MACOS: ${{ inputs.enable-macos }}
|
|
WEB: ${{ inputs.enable-web }}
|
|
WINDOWS: ${{ inputs.enable-windows }}
|
|
with:
|
|
result-encoding: string
|
|
script: |
|
|
const { ANDROID, IOS, LINUX, MACOS, WEB, WINDOWS } = process.env;
|
|
const url = `https://builds.lunasea.app/#${ process.env.BUILD_TITLE }`;
|
|
let _base = `[Download]${url}`;
|
|
if ( ANDROID || IOS || LINUX || MACOS || WEB || WINDOWS) {
|
|
_base += '\n\nThis release is only available for the following platforms: ';
|
|
|
|
const platforms = [];
|
|
if (ANDROID) platforms.push('Android');
|
|
if (IOS) platforms.push('iOS');
|
|
if (LINUX) platforms.push('Linux');
|
|
if (MACOS) platforms.push('macOS');
|
|
if (WEB) platforms.push('Web');
|
|
if (WINDOWS) platforms.push('Windows');
|
|
|
|
_base += platforms.map((p) => `**${p}**`).join(', ');
|
|
}
|
|
return _base;
|
|
|
|
- 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: ${{ steps.message.outputs.result }}
|