Skip to content

Commit

Permalink
Merge pull request #35 from adafycheng/adafycheng-patch-1
Browse files Browse the repository at this point in the history
Update main.yml
  • Loading branch information
adafycheng committed Jan 19, 2024
2 parents 61a43e4 + 9467f53 commit 51e0bfc
Show file tree
Hide file tree
Showing 3 changed files with 44 additions and 11 deletions.
49 changes: 41 additions & 8 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,7 @@ jobs:
strategy:
matrix:
node-version: [16.x, 18.x, 20.x]

# Steps represent a sequence of tasks that will be executed as part of the job

steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v3
Expand All @@ -45,17 +44,51 @@ jobs:
run: npm ci
- run: npm run build --if-present
- run: npm test
- run: cd build
# Push to GitHub Pages

deploy_github_pages:
needs: build
runs-on: ubuntu-latest

env:
GITHUB_PAGES_REPO: adafycheng/adafycheng.github.io
GITHUB_PAGES_PATH: github_pages

strategy:
matrix:
node-version: [20.x]

steps:
- uses: actions/checkout@v3
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v3
with:
repository: adafycheng.github.io
node-version: ${{ matrix.node-version }}
- name: Install dependencies
run: npm ci
- run: npm run build --if-present
- name: Check out from GitHub Pages
uses: actions/checkout@v3
with:
repository: ${{ env.GITHUB_PAGES_REPO }}
token: ${{ secrets.ACTIONS_GITHUB_TOKEN }}
path: ${{ env.GITHUB_PAGES_PATH }}
ref: 'main'
- name: setup git config
- name: Copy files to GitHub Pages repo
run: |
rm ./$GITHUB_PAGES_PATH/static/css/*
rm ./$GITHUB_PAGES_PATH/static/js/*
cp -rf build/* ./$GITHUB_PAGES_PATH
- name: Commit and Push to GitHub Pages
run: |
# Exrtract Application Version
APP_VERSION=`cat package.json | jq -r '.version'`
echo "APP_VERSION: $APP_VERSION"
# Commit and Push
cd $GITHUB_PAGES_PATH
git config user.name "GitHub Actions Bot"
git config user.email "${{ secrets.ACTIONS_GITHUB_EMAIL }}"
git switch -c "v$APP_VERSION"
git add .
git commit
- run: git push origin main
git commit -m "Deploy $APP_VERSION"
git push origin "v$APP_VERSION"
4 changes: 2 additions & 2 deletions package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "portfolio-website-react",
"version": "1.7.0",
"version": "1.7.1",
"description": "Ada Cheng's Portfolio Web Site",
"author": "adafycheng",
"license": "MIT",
Expand Down

1 comment on commit 51e0bfc

@vercel
Copy link

@vercel vercel bot commented on 51e0bfc Jan 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

portfolio-website-react – ./

portfolio-website-react-adafycheng.vercel.app
portfolio-website-react-git-main-adafycheng.vercel.app

Please sign in to comment.