Skip to content

Commit

Permalink
feat: add GitHub Actions workflow for deploying static content to Git…
Browse files Browse the repository at this point in the history
…Hub Pages

- Introduced a new GitHub Actions workflow in `deploy.yml` for building and deploying static content.
- Configured the workflow to trigger on pushes to the `main` branch and allow manual execution.
- Set up jobs for running unit tests and deploying to GitHub Pages, ensuring a streamlined CI/CD process.
- Included steps for Node.js setup, dependency installation, unit testing, building the application, and deploying the built content.
  • Loading branch information
alfredoperez committed Jan 2, 2025
1 parent 5df753e commit c954b68
Showing 1 changed file with 59 additions and 0 deletions.
59 changes: 59 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Build and deploy static content to Pages

on:
# Runs on pushes targeting the default branch
push:
branches: ['main']

# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:

# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write

# Allow one concurrent deployment
concurrency:
group: 'pages'
cancel-in-progress: true

jobs:
unit-tests:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Install dependencies
run: npm ci
- name: Run unit tests
run: npm run test

deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: [unit-tests]
steps:
- uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
- name: Build
run: npx nx run documentation:build --configuration=production
- name: Setup Pages
uses: actions/configure-pages@v4
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
with:
path: 'dist/apps/ngx-dev-toolbar-demo/browser'
- name: Deploy to GitHub Pages
uses: actions/deploy-pages@v4

0 comments on commit c954b68

Please sign in to comment.