Next Build Deploy Test Push #38
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: Next Build Deploy Test Push | |
env: | |
VERCEL_ORG_ID: ${{ secrets.VERCEL_ORG_ID }} | |
VERCEL_PROJECT_ID: ${{ secrets.VERCEL_PROJECT_ID }} | |
GH_TOKEN: ${{secrets.PULL_REQ}} | |
on: | |
schedule: | |
- cron: '0 0 * * 0' # Runs every Sunday at midnight | |
workflow_dispatch: # Allows manual triggering | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v4 | |
with: | |
repository: eelab-dev/EEcircuit | |
ref: next # Checkout the "next" branch | |
# Delete bot branch if it exists | |
- name: Delete 'bot' branch if it exists | |
run: | | |
if git show-ref --verify --quiet refs/heads/bot; then | |
git branch -D bot | |
fi | |
# Create new 'bot' branch from 'next' | |
- name: Create new 'bot' branch | |
run: | | |
git checkout next | |
git checkout -b bot | |
- name: Set up Docker Buildx | |
uses: docker/setup-buildx-action@v3 | |
- name: Create Empty Build Directory | |
run: mkdir -p Docker/build | |
#- name: Build Docker Image | |
#run: docker build --no-cache -t eecircuit ./Docker | |
#- name: Run Docker Container | |
#run: docker run -t -v $(realpath ./Docker):/mnt eecircuit | |
#- name: Run Inject.js | |
#run: node ./Docker/inject.js | |
#- name: Rename and Copy Files to Main Directory | |
#run: | | |
#cp ./Docker/build/spice.wasm ./src/sim/spice.wasm | |
#cp ./Docker/build/spice-eesim.js ./src/sim/spice.js | |
- name: Update Dependencies | |
run: npx --yes npm-check-updates -u | |
- name: Install Dependencies | |
run: npm install | |
#- name: Build Project with Vite | |
#run: npm run build | |
#- name: Deploy to Vercel | |
#run: npx vercel --token=${{ secrets.VERCEL_TOKEN }} | |
- name: Install Playwright Browsers | |
run: npx playwright install --with-deps | |
- name: Run Playwright tests | |
run: npx playwright test -g "EEcircuit Next" | |
- uses: actions/upload-artifact@v4 | |
if: always() | |
with: | |
name: playwright-report | |
path: playwright-report/ | |
retention-days: 30 | |
# First handle any uncommitted changes | |
- name: Stage and commit any changes | |
run: | | |
git add . | |
git diff --staged --quiet || git commit -m "Automated: Stage uncommitted changes" | |
# Create Pull Request only if there are differences | |
- name: Create Pull Request | |
run: | | |
if [ $(git rev-list --count next..bot) -gt 0 ]; then | |
gh pr create \ | |
--base next \ | |
--head bot \ | |
--title "Update from bot branch" \ | |
--body "Automated pull request to merge changes from the bot branch to next." | |
else | |
echo "No changes to create PR for" | |
fi | |