Update template & Tailwind config (#22) #22
This file contains hidden or 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
| name: Deploy CD | |
| # GitHub variables: | |
| # - VERSION_TAG | |
| # - ASTRO_SITE_URL | |
| # - ASTRO_BASE_PATH | |
| # - ASTRO_ASSETS_PREFIX | |
| # GitHub secrets: N/A | |
| on: | |
| # Run on push on production branches | |
| push: | |
| branches: | |
| # Production | |
| - main | |
| paths: | |
| # CI/CD files | |
| - '.github/workflows/deploy.yml' | |
| - 'docker-compose.yml' | |
| - 'docker-compose.cicd.yml' | |
| - '.env' | |
| # Application files | |
| - 'app/**' | |
| # Run on manual triggers | |
| workflow_dispatch: | |
| # Set default GITHUB_TOKEN permissions for the workflow | |
| permissions: | |
| contents: read | |
| # Set workflow concurrency rules | |
| concurrency: | |
| group: ${{ github.workflow }} | |
| cancel-in-progress: true | |
| jobs: | |
| # Build job | |
| build: | |
| name: Build | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 20 | |
| steps: | |
| # Dependency steps | |
| - name: Checkout | |
| uses: actions/checkout@v4 | |
| # Execution steps | |
| - name: Copy Git history in app source folder | |
| run: | | |
| # Copy app source code git history | |
| # Initialize Git repository in app source code directory | |
| ( | |
| cd app/app && | |
| rm -rf .git && | |
| git init -b main && | |
| git config receive.denyCurrentBranch ignore | |
| ) | |
| # Get Git history of app source code | |
| git subtree split --prefix=app/app -b app-history | |
| # Push Git history to app source code directory | |
| ( | |
| git remote add app ./app/app/.git && | |
| git push app app-history:main && | |
| git branch -D app-history && | |
| git remote remove app | |
| ) | |
| - name: Pull dependencies | |
| run: | | |
| # docker compose pull --ignore-buildable | |
| docker compose \ | |
| -f ./docker-compose.yml -f ./docker-compose.cicd.yml \ | |
| --env-file .env \ | |
| pull --ignore-buildable | |
| - name: Build for production | |
| env: | |
| # Build configuration | |
| BUILD_CHECK: 'false' # Skip type checks | |
| # Deployment configuration | |
| GITHUB_REPOSITORY_URL: https://github.com/${{ github.repository }} | |
| GITHUB_SHA: ${{ github.sha }} | |
| VERSION_TAG: ${{ vars.VERSION_TAG }} | |
| # Astro configuration | |
| ASTRO_SITE_URL: ${{ vars.ASTRO_SITE_URL }} | |
| ASTRO_BASE_PATH: ${{ vars.ASTRO_BASE_PATH }} | |
| ASTRO_ASSETS_PREFIX: ${{ vars.ASTRO_ASSETS_PREFIX }} | |
| # Application configuration | |
| # Add env vars for your application here. | |
| run: | | |
| # docker compose build | |
| export DOCKER_UID="$(id -u)" | |
| docker compose \ | |
| -f ./docker-compose.yml -f ./docker-compose.cicd.yml \ | |
| --env-file .env \ | |
| build | |
| - name: Copy application files | |
| run: | | |
| # docker compose up | |
| export DOCKER_UID="$(id -u)" | |
| docker compose \ | |
| -f ./docker-compose.yml -f ./docker-compose.cicd.yml \ | |
| --env-file .env \ | |
| up | |
| - name: Upload GitHub Pages artifact | |
| uses: actions/upload-pages-artifact@v3 | |
| with: | |
| path: ./app/dist | |
| # Deploy job | |
| deploy: | |
| name: Deploy | |
| runs-on: ubuntu-latest | |
| timeout-minutes: 10 | |
| # Job dependencies | |
| needs: | |
| - build | |
| # Set GITHUB_TOKEN permissions for the job | |
| permissions: | |
| id-token: write | |
| pages: write | |
| # Set deployment environment | |
| environment: | |
| name: production | |
| url: ${{ steps.deployment.outputs.page_url }} | |
| steps: | |
| # Execution steps | |
| - name: Deploy to GitHub Pages | |
| id: deployment | |
| uses: actions/deploy-pages@v4 |