Add project screenshots toindex page deploy action #9
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
# Tutorial: https://dev.to/devloker/deploy-a-react-projects-that-are-inside-a-subdirectories-to-github-pages-using-github-actions-cicd-3n9l | |
name: Deploy to GitHub Pages | |
on: | |
push: | |
branches: ["main"] | |
workflow_dispatch: | |
permissions: | |
contents: read | |
pages: write | |
id-token: write | |
concurrency: | |
group: "pages" | |
cancel-in-progress: true | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: Set up Node | |
uses: actions/setup-node@v4 | |
with: | |
node-version: latest | |
# index page | |
- name: Deploy index page | |
run: | | |
mkdir -p deploy | |
cp -r index.html style.css 1-digital-business-card/screenshot.png 2-travel-journal/screenshot.png 3-quizzical/screenshot-start.png 3-quizzical/screenshot-questions.png 3-quizzical/screenshot-answers.png deploy/ | |
# digital-business-card project | |
- name: Build digital-business-card | |
run: | | |
cd 1-digital-business-card | |
npm install && npm run build | |
cd .. | |
mkdir -p deploy/1-digital-business-card | |
cp -r 1-digital-business-card/dist/* deploy/1-digital-business-card/ | |
# travel-journal project | |
- name: Build travel-journal | |
run: | | |
cd 2-travel-journal | |
npm install && npm run build | |
cd .. | |
mkdir -p deploy/2-travel-journal | |
cp -r 2-travel-journal/dist/* deploy/2-travel-journal/ | |
# quizzical project | |
- name: Build quizzical | |
run: | | |
cd 3-quizzical | |
npm install && npm run build | |
cd .. | |
mkdir -p deploy/3-quizzical | |
cp -r 3-quizzical/dist/* deploy/3-quizzical/ | |
- name: Setup Pages | |
uses: actions/configure-pages@v4 | |
- name: Upload artifact | |
uses: actions/upload-pages-artifact@v3 | |
with: | |
path: "./deploy" | |
- name: Deploy to GitHub Pages | |
id: deployment | |
uses: actions/deploy-pages@v4 |