Merge pull request #1103 from traPtitech/issue-1102 #59
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: staging | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/setup-node@v3 | |
with: | |
node-version: 18.x | |
cache: npm | |
- run: npm ci | |
- run: npm run gen-api | |
- run: npm run build | |
env: | |
NODE_ENV: production | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: dist | |
path: ./dist | |
deploy-staging: | |
name: Deploy staging | |
runs-on: ubuntu-latest | |
needs: [build] | |
steps: | |
- name: Install SSH key | |
uses: shimataro/ssh-key-action@v2 | |
with: | |
key: ${{ secrets.STAGING_SSH_KEY }} | |
known_hosts: ${{ secrets.STAGING_KNOWN_HOSTS }} | |
- uses: actions/download-artifact@v3 | |
with: | |
name: dist | |
path: ./dist | |
- name: Deploy | |
run: rsync -e ssh --rsync-path='sudo rsync' -rltpzhv --delete ./dist ${{ secrets.STAGING_DEPLOY_USER }}@${{ secrets.STAGING_DEPLOY_HOST }}:${{ secrets.STAGING_DEPLOY_RSYNC_DESTINATION }} |