[chore] fix bundling during deployment (#295) #214
This file contains hidden or 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: Deploy to staging | |
| on: | |
| push: | |
| branches: staging | |
| jobs: | |
| fortrabbit: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checking out git | |
| uses: actions/checkout@v4 | |
| with: | |
| ref: staging | |
| fetch-depth: 0 | |
| - name: Setup SSH key | |
| run: | | |
| mkdir -p $HOME/.ssh | |
| echo "${{ secrets.SSH_PRIVATE_KEY }}" > $HOME/.ssh/deploy_key | |
| chmod 600 $HOME/.ssh/deploy_key | |
| - name: Add fortrabbit git remote | |
| run: git remote add fortrabbit ${{ secrets.APP_NAME_STAGING }}@${{ secrets.HOST }}:${{ secrets.APP_NAME_STAGING }}.git | |
| - name: Push to fortrabbit | |
| run: GIT_SSH_COMMAND='ssh -i $HOME/.ssh/deploy_key -o StrictHostKeyChecking=no' git push -u fortrabbit "${GITHUB_REF:11}":main | |
| - name: Setting up node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "24" | |
| - name: Install node packages | |
| run: npm install | |
| - name: Create assets | |
| run: npm run build | |
| - name: Sync assets to fortrabbit | |
| run: | | |
| source="web/static/dist/*" | |
| target="~/web/static/dist" | |
| sh -c "rsync -av --delete-after -e 'ssh -i $HOME/.ssh/deploy_key -o StrictHostKeyChecking=no' ${source} --rsync-path='mkdir -p ${target} && rsync' ${{ secrets.APP_NAME_STAGING }}@${{ secrets.HOST }}:${target}" | |
| - name: Delete SSH key | |
| run: rm $HOME/.ssh/deploy_key |