Deploy with custom GitHub Actions workflow

This commit is contained in:
Ariful Alam 2022-08-20 15:53:55 +06:00
parent ec3cdf4f68
commit 5fe64aecb3

View File

@ -1,14 +1,22 @@
name: Deploy to gh-pages Branch name: Deploy to GitHub Pages
on: on:
push: push:
branches: [main] branches: [main]
workflow_dispatch:
permissions: permissions:
contents: write contents: read
pages: write
id-token: write
concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true
jobs: jobs:
deploy: build:
runs-on: ubuntu-latest runs-on: ubuntu-latest
steps: steps:
- name: Checkout repository - name: Checkout repository
@ -18,9 +26,13 @@ jobs:
uses: actions/setup-node@v3 uses: actions/setup-node@v3
with: with:
node-version: 16.x node-version: 16.x
cache: 'npm'
- name: Cache dependencies - name: Setup Pages
uses: actions/cache@v2 uses: actions/configure-pages@v1
- name: Restore cache
uses: actions/cache@v3
with: with:
path: | path: |
**/node_modules **/node_modules
@ -29,13 +41,21 @@ jobs:
- name: Install dependencies - name: Install dependencies
run: npm ci run: npm ci
- name: Build - name: Build with vite
run: npm run build run: npm run build
env:
CI: ''
- name: Deploy - name: Upload artifact
uses: JamesIves/github-pages-deploy-action@v4 uses: actions/upload-pages-artifact@v1
with: with:
branch: gh-pages path: ./dist
folder: dist
deploy:
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
runs-on: ubuntu-latest
needs: build
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v1