Skip to content

Commit

Permalink
Use environments in the production deployment workflow too
Browse files Browse the repository at this point in the history
  • Loading branch information
kafeman committed Dec 16, 2023
1 parent 2d78187 commit 7730811
Showing 1 changed file with 15 additions and 10 deletions.
25 changes: 15 additions & 10 deletions .github/workflows/prod.yaml
Original file line number Diff line number Diff line change
@@ -1,30 +1,35 @@
name: Build the main branch and deploy it to habra-adm.ru
on:
workflow_run:
workflows:
- Test each and every commit
push:
branches:
- main
types:
- completed
permissions:
contents: read
deployments: write
concurrency:
group: deploy
group: deployment
cancel-in-progress: false
jobs:
build-and-deploy:
runs-on: ubuntu-latest
if: ${{ github.event.workflow_run.conclusion == 'success' }}
environment:
name: habra-adm.ru
url: https://habra-adm.ru
steps:
- uses: actions/checkout@v3
- uses: actions/setup-node@v3
- run: npm ci
- run: npm run build
env:
NODE_ENV: production
- name: Deploy!
- name: Deploy to habra-adm.ru
run: |
mkdir ~/.ssh
echo "${{vars.SSH_KNOWN_HOSTS}}" > ~/.ssh/known_hosts
echo "${{ vars.SSH_KNOWN_HOSTS }}" > ~/.ssh/known_hosts
eval `ssh-agent`
echo "${{secrets.SSH_PRIVATE_KEY}}" | ssh-add -
echo "$SSH_PRIVATE_KEY" | ssh-add -
rsync --recursive --verbose dist/ [email protected]:/var/www/habra-adm.ru
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
- name: Check if the URL is accessible
run: curl --fail https://habra-adm.ru

0 comments on commit 7730811

Please sign in to comment.