Skip to content

Commit

Permalink
Create deploy.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
bhaskar1001101 authored Apr 25, 2024
1 parent b24a598 commit 6f99cc1
Showing 1 changed file with 50 additions and 0 deletions.
50 changes: 50 additions & 0 deletions .github/workflows/deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
name: Deploy to Deploy Branch

on:
push:
branches:
- main
workflow_dispatch:

jobs:
deploy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2

- name: Copy files from main to deploy branch
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git checkout deploy
git rm -rf .
git checkout main -- .
git add .
git commit -m "Copy files from main to deploy branch"
git push origin deploy
- name: Install dependencies and build
run: |
git checkout deploy
npm install
npm run build
- name: Remove files and folders except dist
run: |
git checkout deploy
find . -type f -not -path './dist/*' -delete
find . -type d -not -path './dist' -delete
- name: Move files from dist to root
run: |
git checkout deploy
mv dist/* .
rm -rf dist
- name: Commit and push changes
env:
PAT_TOKEN: ${{ secrets.PAT_TOKEN }}
run: |
git add .
git commit -m "Push build files to deploy branch"
git push origin deploy

0 comments on commit 6f99cc1

Please sign in to comment.