Skip to content

Commit

Permalink
Update gh pages workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelklehr committed May 12, 2023
1 parent 9b07823 commit 8c09b9d
Showing 1 changed file with 71 additions and 0 deletions.
71 changes: 71 additions & 0 deletions .github/workflows/deploy-to-gh-pages.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@

name: Build and Deploy
on:
push:
branches:
- main
- master

jobs:
build-and-deploy:

strategy:
matrix:
folder:
- ./

runs-on: ubuntu-latest
steps:
- name: Checkout 🛎️
uses: actions/[email protected]

- name: Read package.json node and npm engines version
uses: skjnldsv/[email protected]
id: versions
with:
path: ${{matrix.folder}}
fallbackNode: '^12'
fallbackNpm: '^6'

- name: Set up node ${{ steps.versions.outputs.nodeVersion }}
uses: actions/setup-node@v2
with:
node-version: ${{ steps.versions.outputs.nodeVersion }}

- name: Set up npm ${{ steps.versions.outputs.npmVersion }}
run: npm i -g npm@"${{ steps.versions.outputs.npmVersion }}"

- name: Cache node modules
uses: actions/cache@v1
env:
cache-name: cache-node-modules
with:
path: ~/.npm # npm cache files are stored in `~/.npm` on Linux/macOS
key: ${{ runner.os }}-build-${{ env.cache-name }}-${{ hashFiles('**/package-lock.json') }}
restore-keys: |
${{ runner.os }}-build-${{ env.cache-name }}-
${{ runner.os }}-build-
${{ runner.os }}-
- name: Install and Build 🔧
env:
REPO_NAME: ${{ github.event.repository.name }}
run: |
cd ${{matrix.folder}}
npm install
npm run build
- name: Create branch
uses: peterjgrainger/[email protected]
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
with:
branch: gh-pages

- name: Deploy 🚀
uses: JamesIves/[email protected]
with:
branch: gh-pages
folder: ${{ matrix.folder }}/dist
target-folder: ${{ matrix.folder }}
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 8c09b9d

Please sign in to comment.