Skip to content

Fix background & code syntax for Treashunt 2028 S2 Project #61

Fix background & code syntax for Treashunt 2028 S2 Project

Fix background & code syntax for Treashunt 2028 S2 Project #61

Workflow file for this run

name: Deploy to GitHub Pages
on:
# Run on push events on primary branches
push:
branches:
- master
paths:
- 'app/**'
- 'Dockerfile'
- 'docker-compose*.yml'
# Run on pull request events to primary branches
pull_request:
branches:
- master
paths:
- 'app/**'
- 'Dockerfile'
- 'docker-compose*.yml'
# Run on manual triggers
workflow_dispatch:
# Set GITHUB_TOKEN permissions for the workflow
permissions:
contents: read
# Restrict concurrent deployments
concurrency:
group: ${{ github.workflow }}-${{ github.event_name }}-${{ github.ref }}
cancel-in-progress: true
jobs:
# Build job
build:
name: Build site artifact
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 ./dist
- name: Upload artifact
# Only run on:
# - Push events to `master`.
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/master'
uses: actions/upload-pages-artifact@v3
with:
path: ./dist
# Deploy job
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
timeout-minutes: 5
# Dependencies
needs:
- build
# Only run on:
# - Push events to `master`.
if: |
github.event_name == 'push' &&
github.ref == 'refs/heads/master'
# Set GITHUB_TOKEN permissions for the job
permissions:
pages: write
id-token: write
# Set the deployment environment
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4