Skip to content

workflow (ionic): upgraded files to use latest actions and commands #39

workflow (ionic): upgraded files to use latest actions and commands

workflow (ionic): upgraded files to use latest actions and commands #39

Workflow file for this run

name: Deploy Ionic to GitHub Pages
on:
push:
paths:
- '*'
- '.github/workflows/gh-pages.yml'
- 'src/**'
- '!**/*.md'
branches:
- ionic
jobs:
build-and-deploy:
permissions:
contents: write
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
# Setup Web environment to install packages.
- name: Setup Web environment
uses: actions/setup-node@v4
with:
node-version: '20'
cache: 'npm'
## only required if project is not in the root
# cache-dependency-path: subdir/package-lock.json
- name: Restore node_modules from cache
uses: actions/cache@v4
with:
path: node_modules
key: ${{ runner.os }}-node-modules-${{ hashFiles('yarn.lock') }}
restore-keys: ${{ runner.os }}-node-modules-
- name: Install packages
run: npm ci
- name: Build web
run: npx ionic build --prod -- --base-href /test_github_action_delete/
# Below 3 steps can also be done by this command, but skipping cause of git info requirement
# - name: Deploy
# run: npx angular-cli-ghpages --dir=www
# below 2 steps to avoid 404 error when refreshing on nested routes
# ref: https://angular.io/guide/deployment#deploy-to-github-pages
- name: Copy index.html
run: cp www/index.html www/newIndex.html
- name: Rename to 404.html
run: mv www/newIndex.html www/404.html
- name: Deploy
uses: peaceiris/actions-gh-pages@v4
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
publish_dir: ./www