Quick fix #657
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: bulid and deploy | |
on: | |
push: | |
branches: | |
- deploy/dev | |
- deploy/production | |
# This allows a subsequently queued workflow run to interrupt previous runs | |
concurrency: | |
group: '${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}' | |
cancel-in-progress: true | |
jobs: | |
build-and-deploy: | |
runs-on: ${{ fromJSON('["ubuntu-latest", "self-hosted"]')[github.repository == 'github/docs-internal'] }} | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v3 | |
- name: build and deploy | |
run: | | |
echo "${{ secrets.SSH_PRIV_KEY }}" | base64 -d > ssh.key | |
chmod 600 ssh.key | |
if [ ${GITHUB_REF#refs/heads/} = "deploy/production" ]; then | |
repoDir="/home/devops/app/production" | |
elif [ ${GITHUB_REF#refs/heads/} = "deploy/dev" ]; then | |
repoDir="/home/devops/app/dev" | |
else | |
echo "Invalid environment." | |
exit 1 | |
fi | |
ssh -o StrictHostKeyChecking=no -i ssh.key devops@134.209.65.8 \ | |
/home/devops/infra/scripts/deploy.sh "$repoDir" "$GITHUB_SHA" | |