63 lines
1.8 KiB
YAML
63 lines
1.8 KiB
YAML
name: Deploy to GitHub Pages
|
|
on:
|
|
workflow_dispatch:
|
|
push:
|
|
branches:
|
|
- main
|
|
|
|
jobs:
|
|
build:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- uses: actions/checkout@v4
|
|
- run: corepack enable
|
|
- uses: actions/setup-node@v4
|
|
with:
|
|
node-version: "22"
|
|
- name: Install dependencies
|
|
run: pnpm install
|
|
- name: Change content submodule URL
|
|
run: cd content/ && git remote set-url origin https://github.com/techitwinner/web-content.git && cd ../
|
|
- name: Fetch contents
|
|
run: git submodule update --init --remote
|
|
- name: Generate static pages
|
|
run: pnpm generate
|
|
env:
|
|
NUXT_PUBLIC_SITE_URL: ${{ vars.NUXT_PUBLIC_SITE_URL }}
|
|
NUXT_PUBLIC_SITE_NAME: ${{ vars.NUXT_PUBLIC_SITE_NAME }}
|
|
NUXT_PUBLIC_BASE_URL: ${{ vars.NUXT_PUBLIC_BASE_URL }}
|
|
NUXT_PUBLIC_SITE_AUTHOR: ${{ vars.NUXT_PUBLIC_SITE_AUTHOR }}
|
|
NUXT_PUBLIC_BUILD_BASE_URL: ${{ vars.NUXT_PUBLIC_BUILD_BASE_URL }}
|
|
- name: Create ZIP artifact
|
|
run: |
|
|
zip -r web.zip ./.output/public
|
|
- name: Upload ZIP artifact
|
|
uses: actions/upload-artifact@v4
|
|
with:
|
|
name: web
|
|
path: web.zip
|
|
- name: Create GitHub Release
|
|
id: release
|
|
uses: ncipollo/release-action@v1
|
|
with:
|
|
tag: ${{ github.sha }}
|
|
name: Release ${{ github.sha }}
|
|
body: Automated release for commit ${{ github.sha }}
|
|
draft: false
|
|
prerelease: false
|
|
files: web.zip
|
|
|
|
deploy:
|
|
needs: build
|
|
permissions:
|
|
pages: write
|
|
id-token: write
|
|
environment:
|
|
name: github-pages
|
|
url: ${{ steps.deployment.outputs.page_url }}
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Deploy to GitHub Pages
|
|
id: deployment
|
|
uses: actions/deploy-pages@v4
|