mirror of
https://github.com/jagandeepbrar/lunasea.git
synced 2026-08-31 04:32:32 +00:00
122 lines
3.2 KiB
YAML
122 lines
3.2 KiB
YAML
name: '[Release] Linux'
|
|
|
|
on:
|
|
workflow_call:
|
|
inputs:
|
|
build_flavor:
|
|
required: true
|
|
type: string
|
|
build_number:
|
|
required: true
|
|
type: string
|
|
build_version:
|
|
required: true
|
|
type: string
|
|
|
|
secrets:
|
|
DISCORD_WEBHOOK:
|
|
required: true
|
|
FIREBASE_OPTIONS:
|
|
required: true
|
|
SNAPCRAFT_TOKEN:
|
|
required: true
|
|
|
|
jobs:
|
|
build:
|
|
name: Build
|
|
runs-on: ubuntu-latest
|
|
outputs:
|
|
output1: ${{ steps.build.outputs.snap }}
|
|
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: Install Secrets
|
|
working-directory: ${{ github.workspace }}
|
|
run: |
|
|
echo ${{ secrets.FIREBASE_OPTIONS }} | base64 --decode > lib/firebase_options.dart
|
|
|
|
- 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 pub get
|
|
|
|
- name: Build LunaSea
|
|
uses: snapcore/action-build@v1
|
|
id: build
|
|
|
|
- name: Upload Snap Build Artifact
|
|
uses: actions/upload-artifact@v2
|
|
with:
|
|
name: linux-${{ inputs.build_flavor }}-${{ github.sha }}
|
|
path: ${{ steps.build.outputs.snap }}
|
|
|
|
- name: Send Discord Message
|
|
uses: sarisia/actions-status-discord@v1
|
|
if: always()
|
|
env:
|
|
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
|
|
with:
|
|
title: '`[${{ inputs.build_flavor }}]` Linux Build'
|
|
description: linux-${{ inputs.build_flavor }}-${{ github.sha }}
|
|
|
|
deploy:
|
|
name: Deploy
|
|
runs-on: ubuntu-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: Install Snapcraft
|
|
uses: samuelmeuli/action-snapcraft@v1
|
|
with:
|
|
snapcraft_token: ${{ secrets.SNAPCRAFT_TOKEN }}
|
|
|
|
- name: Download Snap Build Artifact
|
|
uses: actions/download-artifact@v2
|
|
with:
|
|
name: linux-${{ inputs.build_flavor }}-${{ github.sha }}
|
|
|
|
- name: Deploy to Snapcraft
|
|
run: |
|
|
snapcraft upload --release=${{ inputs.build_flavor }} ${{ needs.build.outputs.output1 }}
|