Add build workflow #11
This file contains hidden or 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
| # .github/workflows/build.yml | |
| name: Build and Deploy | |
| on: | |
| push: | |
| branches: | |
| - vite | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout vite branch | |
| uses: actions/checkout@v3 | |
| with: | |
| fetch-depth: 0 | |
| - name: Set up Node.js | |
| uses: actions/setup-node@v3 | |
| with: | |
| node-version: 20.19.0 | |
| - name: Install dependencies | |
| run: yarn install --frozen-lockfile | |
| - name: Build project | |
| run: yarn run build | |
| - name: Deploy dist to build branch | |
| run: | | |
| cd dist | |
| git init | |
| git config user.name "github-actions[bot]" | |
| git config user.email "github-actions[bot]@users.noreply.github.com" | |
| git remote add origin https://github.com/${{ github.repository }}.git | |
| git checkout -b build || git checkout build | |
| git add . | |
| git commit -m "Deploy to build from ${GITHUB_SHA}" || echo "Nothing to commit" | |
| git push --force "https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}.git" build |