Skip to content

Vue Deploy to GitHub Pages #61

Vue Deploy to GitHub Pages

Vue Deploy to GitHub Pages #61

# This is a basic workflow to help you get started with Actions
name: Vue Deploy to GitHub Pages
# Controls when the workflow will run
on:
# Triggers the workflow on push or pull request events but only for the "master" branch
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
jobs:
# This workflow contains a single job called "build"
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
- name: Checkout the repository
uses: actions/checkout@v3
- name: Cache dependencies
uses: actions/cache@v3
with:
# npm cache files are stored in `~/.npm` on Linux/macOS
path: ~/.npm
key: ${{ runner.os }}-deps-node-modules-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
- name: Set up the NodeJS environment
uses: actions/setup-node@v3
with:
node-version: 14
# Runs a single command using the runners shell
- name: Intro
run: echo Building Vue...
# Runs a set of commands using the runners shell
- name: Build the app
run: |
npm install
npm run build
- name: Upload artifact
uses: actions/upload-artifact@master
with:
name: page
path: dist
if-no-files-found: error
deploy:
runs-on: ubuntu-latest
needs: build
# Sets permissions of the GITHUB_TOKEN to allow deployment to GitHub Pages
permissions:
contents: read
pages: write
id-token: write
environment:
name: github-pages
url: ${{steps.deployment.outputs.page_url}}
steps:
- name: Download artifact
uses: actions/download-artifact@master
with:
name: page
path: .
- name: Configure GitHub pages
uses: actions/configure-pages@v1
- name: Upload GitHub pages artifact
uses: actions/upload-pages-artifact@v2
with:
path: .
- name: Deploy GitHub pages
id: deployment
uses: actions/deploy-pages@v3