Merge pull request #6 from danswater/vite #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: Build and Deploy | |
on: | |
push: | |
branches: [master] | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v4 | |
- name: Setup Node.js | |
uses: actions/setup-node@v4 | |
with: | |
node-version: '20.x' | |
- name: Install Yarn | |
run: | | |
npm install -g yarn | |
- name: Install Dependencies | |
run: | | |
yarn install | |
- name: Build project | |
run: | | |
yarn build | |
- name: Upload generated template | |
uses: actions/upload-artifact@v4 | |
id: upload-generated-template | |
with: | |
name: template-output | |
path: dist | |
- uses: actions/checkout@v4 | |
with: | |
repository: 'danswater/danswater.github.io' | |
ref: 'master' | |
token: ${{ secrets.TEMPLATE_OUTPUT_REPO_TOKEN }} | |
- name: Download generated template | |
uses: actions/download-artifact@v4 | |
with: | |
name: template-output | |
- name: Setup git config | |
run: | | |
git config --global user.name "GitHub Actions" | |
git config --global user.email "dansisabot.github@gmail.com" | |
- name: Deploy project | |
run: | | |
ls -la | |
export COMMIT_MESSAGE="Generated template from ${{ github.repository }}/${{ github.ref}}@${{ github.sha }}" | |
git add . | |
git commit -m "$COMMIT_MESSAGE" | |
git push | |