Deploy to production (Organise routes) #185
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
on: | |
push: | |
branches: | |
- main | |
jobs: | |
tests: | |
uses: ./.github/workflows/test.yml | |
name: Run tests | |
if: ${{ !contains(github.event.head_commit.message, '[skip tests]') }} | |
deploy: | |
concurrency: | |
cancel-in-progress: true | |
group: production | |
needs: tests | |
if: | | |
always() && | |
!contains(needs.tests.result, 'failure') && | |
!contains(needs.tests.result, 'cancelled') | |
environment: | |
name: production | |
url: https://larabox.voidgroup.net | |
runs-on: ubuntu-latest | |
steps: | |
- name: Write deploy key to file | |
run: echo "$DEPLOY_KEY" > larabox_deploy && chmod 0600 larabox_deploy | |
env: | |
DEPLOY_KEY: ${{secrets.DEPLOY_KEY}} | |
- name: Write known host | |
run: mkdir -p ~/.ssh && echo "$DEPLOY_HOSTKEY" >> ~/.ssh/known_hosts | |
env: | |
DEPLOY_HOSTKEY: ${{vars.DEPLOY_HOSTKEY}} | |
- name: Deploy to target | |
run: > | |
ssh -i larabox_deploy "${{vars.DEPLOY_TARGET}}" "${{github.sha}}" | |
name: Deploy to production | |
run-name: Deploy to production (${{ github.event.head_commit.message }}) |