soft-serve.yml

 1name: Soft-Serve
 2
 3on:
 4  push:
 5    branches:
 6      - main
 7
 8jobs:
 9  softserve:
10    runs-on: ubuntu-latest
11    env:
12      CHARM_SOFT_SERVE_KEY: "${{ secrets.CHARM_SOFT_SERVE_KEY }}"
13      SERVER: beta.charm.sh
14      SSH_AUTH_SOCK: /tmp/ssh_agent.sock
15      PUSH_TO: "soft-serve"
16
17    steps:
18      - name: Checkout code
19        uses: actions/checkout@v2
20        with:
21          fetch-depth: 0
22
23      - name: Push to Soft-Serve
24        run: |
25          # Add ssh key
26          mkdir -p ~/.ssh
27          ssh-keyscan $SERVER >> ~/.ssh/known_hosts
28          echo "$CHARM_SOFT_SERVE_KEY" > ~/.ssh/charm_soft_serve_id_rsa
29          chmod 0600 ~/.ssh/charm_soft_serve_id_rsa
30          eval "$(ssh-agent -a $SSH_AUTH_SOCK)"
31          ssh-add ~/.ssh/charm_soft_serve_id_rsa
32          # Add remote
33          git remote add soft-serve ssh://$SERVER/$PUSH_TO
34          # Push to soft-serve
35          git push -f soft-serve HEAD:master
36          rm -rf ~/.ssh/charm_soft_serve_id_rsa