-
Notifications
You must be signed in to change notification settings - Fork 1
116 lines (103 loc) · 3.93 KB
/
build-and-deploy-site.yaml
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
112
113
114
115
116
# This workflow is designed to automate the process of building and deploying a Kotlin/JS web application to GitHub Pages.
# It ensures that whenever changes are merged into the dev branch or when manually triggered, the web application is built,
# packaged, and deployed to the GitHub Pages environment, making it accessible online.
# Key Features:
# - Automated web application build using Kotlin/JS
# - Deployment to GitHub Pages
# - Supports configurable web project module name
# - Manages deployment concurrency and environment settings
# - Provides secure deployment with proper permissions
# Prerequisites:
# - Kotlin Multiplatform/JS project configured with Gradle
# - Web module set up for browser distribution
# - Java 17 or compatible version
# - GitHub Pages enabled in repository settings
# Workflow Configuration:
# - Requires input of `web_package_name` to specify the web project module
# - Uses Windows runner for build process
# - Leverages GitHub Actions for build, pages configuration, and deployment
# Workflow Triggers:
# - Can be manually called from other workflows
# - Supports workflow_call for reusability across projects
# Deployment Process:
# 1. Checkout repository code
# 2. Set up Java development environment
# 3. Build Kotlin/JS web application
# 4. Configure GitHub Pages
# 5. Upload built artifacts
# 6. Deploy to GitHub Pages
### Example Workflow
# This workflow is designed as a reusable workflow. You'll need to call it from another workflow file.
# Create a workflow file (e.g., `.github/workflows/deploy.yml`) that looks like this:
#
# ```yaml
# name: Build And Deploy Web App
#
## Trigger conditions for the workflow
# on:
# pull_request:
# branches: [ "dev" ]
# types: [ closed ]
# workflow_dispatch:
#
# # Concurrency settings to manage multiple workflow runs
# # This ensures orderly deployment to production environment
# concurrency:
# group: "web-pages"
# cancel-in-progress: false
#
# permissions:
# contents: read # Read repository contents
# pages: write # Write to GitHub Pages
# id-token: write # Write authentication tokens
# pull-requests: write # Write to pull requests
#
# jobs:
# build_and_deploy_web:
# name: Build And Deploy Web App
# uses: openMF/mifos-mobile-github-actions/.github/workflows/build-and-deploy-site.yaml@main
# secrets: inherit
# with:
# web_package_name: 'mifospay-web'
# ```
#
# Workflow to build and deploy the web application to GitHub Pages
name: Publish Web App
# Trigger conditions for the workflow
on:
workflow_call:
inputs:
web_package_name:
description: 'Name of the Web project module'
type: string
required: true
# Concurrency settings to manage multiple workflow runs
# This ensures orderly deployment to production environment
concurrency:
#Groups workflow runs related to GitHub Pages deployment.
group: "pages"
# Prevents cancellation of in-progress deployments to ensure stability, especially in production environments.
cancel-in-progress: false
# Grants necessary permissions for reading repository contents, writing to GitHub Pages, and writing authentication tokens.
permissions:
contents: read # Read repository contents
pages: write # Write to GitHub Pages
id-token: write # Write authentication tokens
jobs:
# Main job to build and deploy the web application
build_web_app:
# Configure deployment environment and URL
#Specifies the deployment environment as github-pages and sets the URL using the output from the deployment step.
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
# Use Windows runner for build environment
runs-on: windows-latest
steps:
# Step 1: Check out the repository code to the runner
- uses: actions/checkout@v4
- name: Build & Publish Web App
uses: openMF/[email protected]
id: deployment
with:
web_package_name: ${{ inputs.web_package_name }}