Fix: Build and Publish workflow #17
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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. | |
# Workflow to build and deploy the web application to GitHub Pages | |
name: Publish Web App | |
# Trigger conditions for the workflow | |
on: | |
# Trigger on pull request close events to the dev branch | |
# Automatically triggers the workflow when a pull request is closed and merged into the dev branch. | |
pull_request: | |
branches: [ "dev" ] | |
types: [ closed ] | |
# Allows Manual trigger option from GitHub Actions UI | |
workflow_dispatch: | |
# 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 | |
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 | |
# 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 | |
steps: | |
# Step 1: Check out the repository code to the runner | |
- uses: actions/checkout@v4 | |
# Step 2: Set up Java development environment | |
- uses: actions/setup-java@v4 | |
with: | |
distribution: 'zulu' # Use Zulu distribution of OpenJDK | |
java-version: 17 # Use Java 17 version | |
# Step 3:Executes the Gradle task jsBrowserDistribution to Build the Kotlin/JS web application | |
- name: Build Web(JS) App | |
run: ./gradlew jsBrowserDistribution | |
# Step 4: Configure GitHub Pages settings | |
- name: Setup Pages | |
uses: actions/configure-pages@v5 | |
# Step 5: Upload the built web application as an artifact to GitHub pages | |
- name: Upload static files as artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
# Path to the built web application files | |
path: './mifospay-web/build/dist/js/productionExecutable/' | |
# Step 6: Deploy the artifact to GitHub Pages, making the web application live. | |
- name: Deploy to GitHub Pages | |
id: deployment # ID used for environment URL output | |
uses: actions/deploy-pages@v4 |