Skip to content

[automation] test the publish.yml Git Action #27

[automation] test the publish.yml Git Action

[automation] test the publish.yml Git Action #27

Workflow file for this run

name: deploy gh-pages
on:
push:
branches:
- master
jobs:
build:
name: Build and deploy to Git Page
env:
USER_NAME: JimLin94
USER_EMAIL: ${{secrets.USER_EMAIL}}
PUBLISH_DIR: ./out
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
steps:
- uses: actions/checkout@v2
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v1
with:
node-version: ${{ matrix.node-version }}
- name: npm install
run: |
npm install
- name: npm run build
run: |
npm run build
- name: Commit files & Push commits
run: |
mkdir ./temp
cd ./temp
git init
git remote add origin ${{ secrets.ACCESS_TOKEN }}@github.com/JimLin94/jimlin94.github.io.git
git config --local user.email $USER_EMAIL
git config --local user.name $USER_NAME
git pull origin master
cp -a ../$PUBLISH_DIR/. ./
echo "List all the build files. 🗂"
ls
git add .
git commit -m "${{ github.event.head_commit.message }}"
git status
git push -f origin master
echo "Job done! 🚀"