Skip to content

Fix scripts import & optimizing (#157) #105

Fix scripts import & optimizing (#157)

Fix scripts import & optimizing (#157) #105

Workflow file for this run

name: Deploy to GitHub Pages
on:
# Run on push events on primary branches
push:
branches:
- master
- dev
paths:
- '.github/workflows/pages.yml'
- 'app/**'
- 'docker-compose*.yml'
# Run on pull request events to primary branches
pull_request:
branches:
- master
paths:
- '.github/workflows/pages.yml'
- 'app/**'
- 'docker-compose*.yml'
# Run on manual triggers
workflow_dispatch:
inputs:
environment:
description: 'Workflow environment'
required: true
type: choice
options:
- development
- production
default: 'production'
# Set GITHUB_TOKEN permissions for the workflow
permissions:
contents: read
# Restrict concurrent deployments
concurrency:
group: ${{ github.workflow }}
cancel-in-progress: true
jobs:
# Build job
build:
name: Build
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Build for production
run: docker compose -f docker-compose.yml -f docker-compose.cicd.yml build
env:
GITHUB_REPOSITORY_URL: https://github.com/${{ github.repository }}
GITHUB_SHA: ${{ github.sha }}
- name: Copy application files
run: docker compose -f docker-compose.yml -f docker-compose.cicd.yml run --rm app
- name: Chown dist folder to $USER
run: sudo chown -R $USER:$USER ./app/dist
- name: Upload artifact
# Only run on:
# - Push events to `master`.
# - Manual triggers on `production` environment.
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production')
uses: actions/upload-pages-artifact@v3
with:
path: ./app/dist
# Deploy job
deploy:
name: Deploy
runs-on: ubuntu-latest
timeout-minutes: 5
# Dependencies
needs:
- build
# Only run on:
# - Push events to `master`.
# - Manual triggers on `production` environment.
if: |
(github.event_name == 'push' && github.ref == 'refs/heads/master') ||
(github.event_name == 'workflow_dispatch' && github.event.inputs.environment == 'production')
# Set GITHUB_TOKEN permissions for the job
permissions:
pages: write
id-token: write
# Set the deployment environment
environment:
name: production
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4