Change deploy script to specify "main" instead of `default_branch` (#4557)

This commit is contained in:
NightKev 2024-10-05 21:47:34 -07:00 committed by GitHub
parent c2c41d9be8
commit f9691b872b
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 10 additions and 6 deletions

View File

@ -1,8 +1,12 @@
name: Deploy
name: Deploy Main
on:
push: {}
pull_request: {}
push:
branches:
- main
pull_request:
branches:
- main
jobs:
deploy:
@ -22,7 +26,7 @@ jobs:
env:
NODE_ENV: production
- name: Set up SSH
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
if: github.event_name == 'push' && github.ref_name == 'main'
run: |
mkdir ~/.ssh
echo "${{ secrets.SSH_PUBLIC_KEY }}" > ~/.ssh/id_ed25519.pub
@ -30,12 +34,12 @@ jobs:
chmod 600 ~/.ssh/*
ssh-keyscan -H ${{ secrets.SSH_HOST }} >> ~/.ssh/known_hosts
- name: Deploy build on server
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
if: github.event_name == 'push' && github.ref_name == 'main'
run: |
rsync --del --no-times --checksum -vrm dist/* ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }}:${{ secrets.DESTINATION_DIR }}
ssh -t ${{ secrets.SSH_USER }}@${{ secrets.SSH_HOST }} "~/prmanifest --inpath ${{ secrets.DESTINATION_DIR }} --outpath ${{ secrets.DESTINATION_DIR }}/manifest.json"
- name: Purge Cloudflare Cache
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
if: github.event_name == 'push' && github.ref_name == 'main'
id: purge-cache
uses: NathanVaughn/actions-cloudflare-purge@v3.1.0
with: