Deploy to GitHub Pages #5
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Deploy to GitHub Pages | |
on: | |
workflow_dispatch: # Allows manual trigger | |
release: | |
types: [published] # Runs on new release | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
# Checkout the repository | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Set up Node.js | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '18' # Replace with the Node.js version you need | |
# Install dependencies | |
- name: Install dependencies | |
run: npm install | |
# Set up directories and copy files | |
- name: Build the project, setup directories and copy files | |
run: | | |
mkdir -p pagespublic/www | |
npm run build:production | |
cp -r www/* pagespublic/www | |
# Create redirect index.html | |
- name: Create redirect index.html | |
run: | | |
echo '<!DOCTYPE html><html><head><meta http-equiv="refresh" content="0; url=https://groovelauncher.github.io/www"><title>Redirecting...</title></head><body><p>If you are not redirected automatically, follow this <a href="https://groovelauncher.github.io/www">link</a>.</p></body></html>' > ./pagespublic/index.html | |
# Deploy to GitHub Pages | |
- name: Deploy to GitHub Pages | |
uses: peaceiris/actions-gh-pages@v3 | |
with: | |
personal_token: ${{ secrets.PERSONAL_ACCESS_TOKEN }} | |
publish_dir: ./pagespublic |