DEPLOY_PEMKEY #24
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: Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout code | |
uses: actions/checkout@v2 | |
- name: Set up Go | |
uses: actions/setup-go@v2 | |
with: | |
go-version: '1.21' | |
- name: Cache Go modules | |
uses: actions/cache@v2 | |
with: | |
path: | | |
~/.cache/go-build | |
/go/pkg/mod | |
key: ${{ runner.os }}-go-${{ hashFiles('**/go.sum') }} | |
restore-keys: | | |
${{ runner.os }}-go- | |
- name: Install Buffalo CLI | |
run: | | |
go install github.com/gobuffalo/cli/cmd/buffalo@latest | |
echo "$HOME/go/bin" >> $GITHUB_PATH | |
- name: Build Buffalo app | |
run: | | |
cd api | |
buffalo build -o ./bin/raccoon-mh-playground | |
- name: Prepare SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.DEPLOY_PEMKEY }} | |
- name: Deploy to Server | |
run: | | |
ssh-keyscan -H ${{ secrets.DEPLOY_SERVER }} >> ~/.ssh/known_hosts | |
scp -r ./api/bin/* ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_SERVER }}:${{ secrets.DEPLOY_PATH }} | |
ssh ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_SERVER }} 'bash -c "${{ secrets.DEPLOY_PATH }}/start.sh"' |