mirror of
https://github.com/pagefaultgames/pokerogue.git
synced 2025-07-03 15:02:16 +02:00
add deploy workflow
This commit is contained in:
parent
714f7c1052
commit
f67a85e7c3
20
.github/workflows/build.yml
vendored
20
.github/workflows/build.yml
vendored
@ -7,6 +7,8 @@ on:
|
||||
jobs:
|
||||
build:
|
||||
runs-on: ubuntu-latest
|
||||
outputs:
|
||||
artifact_name: "${{ github.event.repository.name }}-${{ github.ref_name }}-${{ github.sha }}"
|
||||
steps:
|
||||
- uses: actions/checkout@v4
|
||||
- uses: actions/setup-node@v4
|
||||
@ -17,9 +19,23 @@ jobs:
|
||||
- name: Build
|
||||
run: npm run build
|
||||
env:
|
||||
NODE_ENV: production
|
||||
NODE_ENV: production
|
||||
- name: Upload Artifact
|
||||
id: upload-artifact
|
||||
uses: actions/upload-artifact@v4
|
||||
with:
|
||||
name: '${{ github.event.repository.name }}-${{ github.ref_name }}-${{ github.sha }}'
|
||||
name: "${{ github.event.repository.name }}-${{ github.ref_name }}-${{ github.sha }}"
|
||||
path: dist
|
||||
- name: Trigger Deployment
|
||||
# only run on the main branch
|
||||
if: github.event_name == 'push' && github.ref_name == github.event.repository.default_branch
|
||||
uses: peter-evans/repository-dispatch@ff45666b9427631e3450c54a1bcbee4d9ff4d7c0 # v3.0.0
|
||||
with:
|
||||
event-type: deploy-ssh
|
||||
client-payload: |
|
||||
{
|
||||
"ref": "${{ github.ref }}",
|
||||
"sha": "${{ github.sha }}",
|
||||
"artifact-url": "${{ steps.upload-artifact.outputs.artifact-url }}",
|
||||
"artifact-name": "${{ github.event.repository.name }}-${{ github.ref_name }}-${{ github.sha }}"
|
||||
}
|
||||
|
26
.github/workflows/deploy.yml
vendored
Normal file
26
.github/workflows/deploy.yml
vendored
Normal file
@ -0,0 +1,26 @@
|
||||
name: Deploy via SSH
|
||||
|
||||
on:
|
||||
repository_dispatch:
|
||||
types: [deploy-ssh]
|
||||
|
||||
jobs:
|
||||
deploy:
|
||||
runs-on: ubuntu-latest
|
||||
env:
|
||||
ARTIFACT_NAME: ${{ github.event.client_payload.artifact-name }}
|
||||
ARTIFACT_URL: ${{ github.event.client_payload.artifact-url }}
|
||||
steps:
|
||||
- uses: appleboy/ssh-action@029f5b4aeeeb58fdfe1410a5d17f967dacf36262 # v1.0.3
|
||||
with:
|
||||
host: ${{ secrets.SSH_HOST }}
|
||||
username: ${{ secrets.SSH_USER }}
|
||||
key: ${{ secrets.SSH_PRIVATE_KEY }}
|
||||
port: ${{ secrets.SSH_PORT }}
|
||||
script: |
|
||||
cd ${{ secrets.TMP_DIR }}
|
||||
wget -O "${{ env.ARTIFACT_NAME }}.zip" ${{ github.event.client_payload.artifact-url }}
|
||||
unzip -aDo "${{ env.ARTIFACT_NAME }}.zip" -d "${{ env.ARTIFACT_NAME }}"
|
||||
rm -f "${{ env.ARTIFACT_NAME }}.zip"
|
||||
rsync -vR --delete "${{ env.ARTIFACT_NAME }}/" "${{ secrets.DESTINATION_DIR }}"
|
||||
rm -rf ./${{ env.ARTIFACT_NAME }}
|
Loading…
Reference in New Issue
Block a user