-
Notifications
You must be signed in to change notification settings - Fork 12
111 lines (92 loc) · 3.44 KB
/
initialize-app.yml
File metadata and controls
111 lines (92 loc) · 3.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
---
name: Initialize Edge App
on:
workflow_dispatch:
inputs:
environment:
description: 'Target environment for initialization'
required: true
default: 'stage'
type: choice
options:
- stage
- production
edge_app_name:
description: 'Folder name of the edge app (under edge-apps/) to initialize'
required: true
edge_app_title:
description: 'Display title of the edge app (used in instance.yml)'
required: true
build_system:
description: 'Build system for the Edge App'
required: true
default: 'vanilla'
type: choice
options:
- vanilla
- bun
deploy_from_dist:
description: "Deploy from the dist folder. If unchecked, deploy from app's root folder."
required: true
default: true
type: boolean
run-name: Initializing ${{ inputs.edge_app_name }} in ${{ inputs.environment }}
jobs:
deploy:
name: Initializing ${{ inputs.edge_app_name }} in ${{ inputs.environment }}
runs-on: ubuntu-latest
if: github.ref == 'refs/heads/master'
environment: ${{ inputs.environment }}
env:
API_BASE_URL: ${{ inputs.environment == 'stage' && 'https://api.screenlyappstage.com' || 'https://api.screenlyapp.com' }}
APP_NAME: ${{ inputs.edge_app_name }}
APP_PATH: edge-apps/${{ inputs.edge_app_name }}
SCREENLY_API_TOKEN: ${{ secrets.SCREENLY_API_TOKEN }}
MANIFEST_FILE_NAME: ${{ inputs.environment == 'stage' && 'screenly_qc.yml' || 'screenly.yml' }}
steps:
- name: ⬇️ Checkout Repository
uses: actions/checkout@v6
with:
ref: master
- name: 🛠 Install Bun (React/Vue only)
if: ${{ inputs.build_system == 'bun' }}
uses: oven-sh/setup-bun@v2
with:
bun-version: 1.2.2
- name: 🛠 Setup and Build Bun App
if: ${{ inputs.build_system == 'bun' }}
working-directory: ${{ env.APP_PATH }}
run: |
bun install
bun run build
- name: 🔄 Modify APP_PATH based on app type
run: |
if [ "${{ inputs.build_system }}" = "bun" ] && [ "${{ inputs.deploy_from_dist }}" = "true" ]; then
echo "APP_PATH=${{ env.APP_PATH }}/dist" >> "$GITHUB_ENV"
fi
- name: 🛠 Create Edge App
uses: screenly/cli@master
with:
screenly_api_token: ${{ env.SCREENLY_API_TOKEN }}
cli_commands: edge-app create --name="${{ env.APP_NAME }}" --in-place --path="${{ env.APP_PATH }}"
- name: 🚀 Deploy Edge App
uses: screenly/cli@master
with:
screenly_api_token: ${{ env.SCREENLY_API_TOKEN }}
cli_commands: edge-app deploy --path="${{ env.APP_PATH }}"
- name: 📋 Log screenly.yml
run: |
cat ${{ env.APP_PATH }}/${{ env.MANIFEST_FILE_NAME }}
- name: 📄 Create Instance
uses: screenly/cli@master
with:
screenly_api_token: ${{ env.SCREENLY_API_TOKEN }}
cli_commands: edge-app instance create --path="${{ env.APP_PATH }}" --name="${{ inputs.edge_app_title }}"
- name: 🔄 Update Instance
uses: screenly/cli@master
with:
screenly_api_token: ${{ env.SCREENLY_API_TOKEN }}
cli_commands: edge-app instance update --path="${{ env.APP_PATH }}"
- name: 📋 Log instance.yml
run: |
cat ${{ env.APP_PATH }}/instance.yml