feat(ci): build web docker images

[platform:web]
This commit is contained in:
Jagandeep Brar
2022-04-18 23:19:05 -04:00
parent 73c09cc2f5
commit 73fbb1076e
8 changed files with 156 additions and 20 deletions

13
.dockerignore Normal file
View File

@@ -0,0 +1,13 @@
.git/
.dart_tool/
android/
build/
docs/
ios/
linux/
localization/
macos/
node_modules/
shaders/
snap/
windows/

View File

@@ -1,5 +0,0 @@
root: ./docs
structure:
readme: README.md
summary: SUMMARY.md

View File

@@ -11,6 +11,14 @@ inputs:
description: 'App Store Connect API Key'
required: false
default: ''
ghcr-actor:
description: 'GitHub Container Registry Actor'
required: false
default: ''
ghcr-token:
description: 'GitHub Container Registry Token'
required: false
default: ''
google-play-key:
description: 'Google Play Store API Key'
required: false
@@ -52,6 +60,18 @@ runs:
with:
xcode-version: latest-stable
- name: Set up Docker Buildx
if: ${{ inputs.channel == 'docker' }}
uses: docker/setup-buildx-action@v1
- name: Setup GitHub Package Registry
if: ${{ inputs.channel == 'docker' }}
uses: docker/login-action@v1
with:
registry: ghcr.io
username: ${{ inputs.ghcr-actor }}
password: ${{ inputs.ghcr-token }}
- name: Setup Secret Keys
shell: bash
run: |

View File

@@ -6,14 +6,17 @@ on:
build-number:
required: true
type: string
flavor:
required: true
type: string
secrets:
FIREBASE_TOKEN:
required: true
jobs:
build-canvaskit:
name: CanvasKit
build-hosted:
name: Hosted
runs-on: ubuntu-latest
steps:
- name: Setup Environment
@@ -28,5 +31,55 @@ jobs:
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: web-canvaskit
name: web-hosted
path: ${{ github.workspace }}/build/web
build-archive:
name: Archive
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
platform: web
- name: Build LunaSea
run: npm run build:web
- name: Create Archive
uses: thedoctor0/zip-release@0.6.2
with:
type: zip
filename: output/lunasea-web-canvaskit.zip
directory: ${{ github.workspace }}/build/web
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: web-archive
path: ${{ github.workspace }}/output
build-docker:
name: Docker
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_build@master
with:
platform: web
- name: Build LunaSea
uses: docker/build-push-action@v2
with:
context: .
outputs: type=docker,dest=${{ github.workspace}}/output/lunasea-web-docker.tar
tags: |
ghcr.io/jagandeepbrar/lunasea:latest
ghcr.io/jagandeepbrar/lunasea:${{ inputs.flavor }}
ghcr.io/jagandeepbrar/lunasea:${{ github.sha }}
- name: Upload Artifact
uses: actions/upload-artifact@v3
with:
name: web-docker
path: ${{ github.workspace }}/output

View File

@@ -183,6 +183,32 @@ jobs:
APPLE_TEAM_ID: ${{ secrets.APPLE_TEAM_ID }}
run: bundle exec fastlane deploy_appstore groups:${{ inputs.flavor }} pkg:${{ github.workspace }}/output/lunasea-macos-amd64.pkg
web-docker:
name: Docker
if: ${{ inputs.enable-web == 'true' }}
runs-on: ubuntu-latest
steps:
- name: Setup Environment
uses: JagandeepBrar/LunaSea/.github/actions/prepare_for_deployment@master
with:
channel: docker
ghcr-actor: ${{ github.actor }}
ghcr-token: ${{ github.token }}
- name: Download Docker Image
uses: actions/download-artifact@v3
with:
name: web-docker
path: ${{ github.workspace }}/output
- name: Load Docker Image
run: |
docker load --input ${{ github.workspace}}/output/lunasea-web-docker.tar
docker image ls -a
- name: Deploy to GitHub Container Registry
run: docker image push --all-tags ghcr.io/jagandeepbrar/lunasea
web-netlify:
name: Netlify
if: ${{ inputs.enable-web == 'true' }}
@@ -196,7 +222,7 @@ jobs:
- name: Download Web Package
uses: actions/download-artifact@v3
with:
name: web-canvaskit
name: web-hosted
path: ${{ github.workspace }}/output
- name: Determine Release Channel
@@ -278,6 +304,13 @@ jobs:
name: windows-app-package
path: ${{ github.workspace }}/output
- name: Download Web Archive
if: ${{ inputs.enable-web == 'true' }}
uses: actions/download-artifact@v3
with:
name: web-archive
path: ${{ github.workspace }}/output
- name: Download Windows MSIX Installer
if: ${{ inputs.enable-windows == 'true' }}
uses: actions/download-artifact@v3

View File

@@ -99,6 +99,7 @@ jobs:
uses: JagandeepBrar/LunaSea/.github/workflows/build_web.yml@master
with:
build-number: ${{ needs.prepare.outputs.build-number }}
flavor: ${{ github.event.inputs.flavor || 'edge' }}
secrets:
FIREBASE_TOKEN: ${{ secrets.FIREBASE_TOKEN }}

21
Dockerfile Normal file
View File

@@ -0,0 +1,21 @@
# Build
FROM debian:latest as build
ENV PATH="/usr/local/flutter/bin:/usr/local/flutter/bin/cache/dart-sdk/bin:$PATH"
RUN apt-get update
RUN apt-get install -y curl git wget unzip
RUN apt-get clean
RUN git clone https://github.com/flutter/flutter.git /usr/local/flutter
RUN flutter channel stable
RUN flutter upgrade
RUN mkdir /lunasea/
COPY . /lunasea/
WORKDIR /lunasea/
RUN flutter build web
# Runtime
FROM nginx:alpine
LABEL org.opencontainers.image.source="https://github.com/JagandeepBrar/LunaSea"
COPY --from=build /lunasea/build/web /usr/share/nginx/html

View File

@@ -29,6 +29,17 @@ extension StringExtension on String {
return split.join(_wordDelimiter);
}
Future<void> copyToClipboard({
bool showSnackBar = true,
}) async {
await Clipboard.setData(ClipboardData(text: this));
if (showSnackBar)
showLunaSuccessSnackBar(
title: 'Copied',
message: 'Copied content to the clipboard',
);
}
}
extension StringLinksExtension on String {
@@ -90,15 +101,4 @@ extension StringLinksExtension on String {
/// Attach this string as a series ID to TVMaze and attempt to launch it as a URL.
Future<void> lunaOpenTVMaze() async =>
await _openLink('https://www.tvmaze.com/shows/$this');
Future<void> copyToClipboard({
bool showSnackBar = true,
}) async {
await Clipboard.setData(ClipboardData(text: this));
if (showSnackBar)
showLunaSuccessSnackBar(
title: 'Copied',
message: 'Copied content to the clipboard',
);
}
}