media button refinement #48
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: production deploy | |
on: | |
push: | |
branches: ["main"] | |
pull_request: | |
branches: ["main"] | |
jobs: | |
# test: | |
# ... | |
deploy: | |
runs-on: ubuntu-latest | |
environment: production | |
if: github.event_name == 'push' && github.ref == 'refs/heads/main' | |
# needs: test | |
steps: | |
- name: Configure SSH | |
run: | | |
mkdir -p ~/.ssh/ | |
echo "$SSH_KEY" > ~/.ssh/prod.key | |
chmod 600 ~/.ssh/prod.key | |
cat >>~/.ssh/config <<END | |
Host prod | |
HostName $SSH_HOST | |
User $SSH_USER | |
IdentityFile ~/.ssh/prod.key | |
StrictHostKeyChecking no | |
END | |
env: | |
SSH_USER: ${{ secrets.PROD_SSH_USER }} | |
SSH_KEY: ${{ secrets.PROD_SSH_KEY }} | |
SSH_HOST: ${{ secrets.PROD_SSH_HOST }} | |
- name: Get latest source | |
run: ssh prod 'cd /mux && git fetch && git pull' | |
- name: Restart the server | |
run: ssh prod 'systemctl restart chatmux' |