Final few edits for the big update (#163) #67
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: Deploy to staging | |
on: | |
push: | |
branches: [main] | |
jobs: | |
deploy_staging: | |
if: github.repository_owner == 'ParkingReformNetwork' | |
runs-on: ubuntu-latest | |
steps: | |
- name: Check out repository code | |
uses: actions/checkout@v3 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Install dependencies | |
run: npm ci | |
- name: Build | |
run: npm run build | |
- name: Run tests on dist/ | |
run: npm run test-dist | |
- name: Archive dist/ contents | |
run: | | |
cd dist | |
tar -czf ../dist_contents.tar.gz * | |
- name: Copy dist/ to server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.PRN_SERVER_HOST }} | |
username: ${{ secrets.PRN_SERVER_USERNAME }} | |
key: ${{ secrets.PRN_SERVER_PRIVATE_KEY }} | |
source: dist_contents.tar.gz | |
target: /var/www/${{ secrets.PRN_SERVER_HOST }}/plm-staging | |
- name: Extract on server | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.PRN_SERVER_HOST }} | |
username: ${{ secrets.PRN_SERVER_USERNAME }} | |
key: ${{ secrets.PRN_SERVER_PRIVATE_KEY }} | |
script: | | |
tar -xzf /var/www/${{ secrets.PRN_SERVER_HOST }}/plm-staging/dist_contents.tar.gz -C /var/www/${{ secrets.PRN_SERVER_HOST }}/plm-staging | |
rm /var/www/${{ secrets.PRN_SERVER_HOST }}/plm-staging/dist_contents.tar.gz |