Skip to content

Commit

Permalink
ci: optimize
Browse files Browse the repository at this point in the history
  • Loading branch information
CyanChanges committed Nov 13, 2024
1 parent 4dcac87 commit 62d410d
Showing 1 changed file with 40 additions and 10 deletions.
50 changes: 40 additions & 10 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -1,34 +1,51 @@
# https://github.com/actions/deploy-pages#usage
name: Deploy to GitHub Pages
on:
push:
branches:
- deploy
workflow_run:
workflows:
- Sync
types:
- completed
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- uses: actions/checkout@v4
with:
ref: deploy
- uses: oven-sh/setup-bun@v2
with:
bun-version: latest
- name: Cache Node Modules
id: cache-blackhole
uses: actions/cache/restore@v4
with:
path: node_modules
key: blackhole
# Pick your own package manager and build script
- run: bun install --locked
- name: Save Primes
id: cache-blackhole
uses: actions/cache/save@v4
with:
path: node_modules
key: blackhole
- run: bun run build --preset github_pages
- run: npx nuxt build --preset github_pages
- name: Upload artifact
uses: actions/upload-pages-artifact@v3
uses: actions/upload-artifact@v4
with:
name: build-output
path: ./.output/public
# Deployment job
deploy:
# Add a dependency to the build job
needs: build
# Grant GITHUB_TOKEN the permissions required to make a Pages deployment
permissions:
pages: write # to deploy to Pages
contents: write # to deploy to gh_pages branch
# pages: write # to deploy to Pages
id-token: write # to verify the deployment originates from an appropriate source
# Deploy to the github_pages environment
environment:
Expand All @@ -37,6 +54,19 @@ jobs:
# Specify runner + deployment step
runs-on: ubuntu-latest
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v4
- uses: actions/checkout@v4
- name: Download Artifact
uses: actions/download-artifact@v4
with:
name: build-output
path: dist
- name: Deploy to gh_pages branch
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: dist
publish_branch: gh_pages
# https://github.com/peaceiris/actions-gh-pages/issues/163
exclude_assets: ''
force_orphan: true
commit_message: 'deploy'

0 comments on commit 62d410d

Please sign in to comment.