60 words
1 minute
Automatically Deploy an Angular Page with GitHub Actions
angular.json
projects > {your-project-name} > architect > build > options > outputPath
If the generated static website is under browser by default, remember to modify or add this property:
"baseHref": "/browser/",Install angular-cli-ghpages:
ng add angular-cli-ghpagesCreate a workflow under .github/workflows
name: Deploy to GitHub Pages
on: push: branches: - master # 或者你要监控的分支名称
jobs: build-and-deploy: runs-on: ubuntu-latest steps: - name: Checkout code uses: actions/checkout@v3
- name: Setup Node.js uses: actions/setup-node@v3 with: node-version: '20' # 请根据项目需求修改 Node.js 版本
- name: Install dependencies run: npm install
- name: Build project run: npm run build
- name: Deploy to GitHub Pages uses: JamesIves/github-pages-deploy-action@v4 with: folder: dist/my-angular-project/browser # 请根据实际输出路径填写 token: ${{ secrets.TOKEN }}
env: GITHUB_TOKEN: ${{ secrets.TOKEN }}Remember to generate a token on GitHub for repository access and add it to the Action’s environment variables.
https://github.com/${your_name}/${your_repo}/settings/secrets/actions
Push to the monitored branch
Update the GitHub Pages configuration and set the Pages branch to gh-pages.
Share
If this article helped you, please share it with others!
Automatically Deploy an Angular Page with GitHub Actions
https://dreaife.tokyo/en/posts/github-action-angular/ Some information may be outdated
Related Posts Smart
1
Angular-Based Animation Showcase Website with Login and Registration (Cognito)
Exploration Build a Bangumi anime browser with Angular 16 and AWS Cognito, including sign-in, registration, search, calendar views, and GitHub Pages deployment.
2
Blog Migration – Mizuki Configuration Notes
Exploration Migrating from NotionNext to Mizuki with Bangumi integration, self-hosted Notion sync, R2 image persistence, and LLM-generated translations.
3
Getting Started with Docker
Study A practical Docker introduction covering containers vs. VMs, images, Docker Hub, core commands, persistent volumes, and Docker Compose.
4
Using SVN
Study A concise SVN guide to centralized version control, repository setup, TortoiseSVN, checkout, update, commit, diff, revert, ignore rules, and branches.
5
Running pyspider on Windows 11 with Docker
Troubleshooting Run pyspider on Windows 11 with Docker or Docker Compose, avoiding local dependency issues and verifying the WebUI at localhost:5000.
Random Posts Random
1
CSAPP Chapter 1: A Tour of Computer Systems
Study 2023-01-15
2
Auction Platform Built with Nest.js and Angular—with Jest Testing and CI/CD
Exploration 2024-12-07
3
Psychological Notes 1
Reflection 2026-03-05
4
Installing Oh My Zsh and Its Plugins on Ubuntu
Troubleshooting 2024-12-03
5
Brimming with Dreams and Hope, Self-Forgiveness and Reverie—A Sakura Doodle
Perspectives 2022-09-18





