name:Deploy Astro to GitHub Pageson:# Trigger the workflow every time you push to the `main` branchpush:branches:[main]# Allows you to run this workflow manually from the Actions tab on GitHub.workflow_dispatch:# Allow this job to clone the repo and create a page deploymentpermissions:contents:readpages:writeid-token:writejobs:build:runs-on:ubuntu-lateststeps:-name:Check out your repository using gituses:actions/checkout@v2-name:Use Node.js 16uses:actions/setup-node@v2with:node-version:'16'cache:'npm'# Not using npm? Change `npm ci` to `yarn install` or `pnpm i`-name:Install dependenciesrun:npm ci# Not using npm? Change `npm run build` to `yarn build` or `pnpm run build`-name:Build Astrorun:npm run build --if-present-name:Upload artifactuses:actions/upload-pages-artifact@v1with:path:./distdeploy:environment:name:github-pagesurl:${{ steps.deployment.outputs.page_url }}runs-on:ubuntu-latestneeds:buildsteps:-name:Deploy to GitHub Pagesid:deploymentuses:actions/deploy-pages@v1
React 的示例工作流程
name:Deploy to React GitHub Pageson:# Trigger the workflow every time you push to the `main` branchpush:branches:[main]# Allows you to run this workflow manually from the Actions tab on GitHub.workflow_dispatch:# Allow this job to clone the repo and create a page deploymentpermissions:contents:readpages:writeid-token:writejobs:build:runs-on:ubuntu-lateststeps:-name:Check out your repository using gituses:actions/checkout@v2-name:Use Node.js 16uses:actions/setup-node@v2with:node-version:'16'cache:'npm'# Not using npm? Change `npm ci` to `yarn install` or `pnpm i`-name:Install dependenciesrun:npm ci# Not using npm? Change `npm run build` to `yarn build` or `pnpm run build`-name:Build Reactrun:npm run build --if-present-name:Upload artifactuses:actions/upload-pages-artifact@v1with:path:./builddeploy:environment:name:github-pagesurl:${{ steps.deployment.outputs.page_url }}runs-on:ubuntu-latestneeds:buildsteps:-name:Deploy to GitHub Pagesid:deploymentuses:actions/deploy-pages@v1
您选择的任何静态生成器的示例模板
name:Deploy to “your frameworks” GitHub Pageson:# Trigger the workflow every time you push to the `main` branchpush:branches:[main]# Allows you to run this workflow manually from the Actions tab on GitHub.workflow_dispatch:# Allow this job to clone the repo and create a page deploymentpermissions:contents:readpages:writeid-token:writejobs:build:runs-on:ubuntu-lateststeps:-name:Check out your repository using gituses:actions/checkout@v2-name:Use “REPLACE WITH THE RUNTIME OF YOUR CHOICE”uses:“REPLACE WITH THE ACTION THAT SETS UP THE RUN TIME OF YOUR CHOICE”# Not using npm? Change `npm ci` to `yarn install` or `pnpm i`-name:Install dependenciesrun:“REPLACE WITH COMMANDS TO INSTALL DEPENDENCIES”# Not using npm? Change `npm run build` to `yarn build` or `pnpm run build`-name:Build “YOUR STATIC GENERATOR HERE”run:“REPLACE WITH YOUR BUILD COMMAND”-name:Upload artifactuses:actions/upload-pages-artifact@v1with:path:“REPLACE WITH YOUR BUILD OUTPUT FOLDER”deploy:environment:name:github-pagesurl:${{ steps.deployment.outputs.page_url }}runs-on:ubuntu-latestneeds:buildsteps:-name:Deploy to GitHub Pagesid:deploymentuses:actions/deploy-pages@v1