Merge pull request #176 from openstreetmap-polska/dev #56
Workflow file for this run
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 production env | |
on: | |
push: | |
branches: | |
- main | |
paths: | |
- src/** | |
- public/** | |
- package*.json | |
- .github/workflows/deploy_production.yml | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
environment: production | |
steps: | |
- name: Install SSH Key | |
uses: kielabokkie/ssh-key-and-known-hosts-action@v1 | |
with: | |
ssh-private-key: ${{ secrets.SSH_PRIVATE_KEY }} | |
ssh-host: ${{ secrets.SSH_HOST_NEW_IP }} | |
ssh-port: ${{ secrets.SSH_HOST_NEW_PORT }} | |
- name: Checkout repo | |
uses: actions/checkout@v3 | |
- name: Setup Node JS | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
cache: 'npm' | |
- name: Install dependencies | |
run: npm install | |
- name: Run TypeScript typecheck | |
run: npm run typecheck | |
- name: Run tests | |
run: npm run test | |
- name: Set git commit | |
run: echo "REACT_APP_GIT_COMMIT=$(git rev-parse --short HEAD)" >> $GITHUB_ENV | |
- name: Build app | |
env: | |
REACT_APP_ENV: production | |
REACT_APP_OSM_API_URL: ${{ secrets.REACT_APP_OSM_API_URL }} | |
REACT_APP_OSM_OAUTH2_CLIENT_ID: ${{ secrets.REACT_APP_OSM_OAUTH2_CLIENT_ID }} | |
REACT_APP_OSM_OAUTH2_CLIENT_SECRET: ${{ secrets.REACT_APP_OSM_OAUTH2_CLIENT_SECRET }} | |
REACT_APP_BACKEND_API_URL: ${{ secrets. REACT_APP_BACKEND_API_URL_NEW }} | |
run: npm run build | |
- name: Create robots.txt | |
run: touch build/robots.txt | |
- name: Run deploy script on host | |
run: | | |
scp -rp -P${{ secrets.SSH_HOST_NEW_PORT }} build/* ${{ secrets.SSH_USER_NEW }}@${{ secrets.SSH_HOST_NEW_IP }}:~/prod-static/ |