fix: not ndjson , normal json #36
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: Go Test Build and Deploy | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-20.04 | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up Go | |
uses: actions/setup-go@v3 | |
with: | |
go-version: 1.22.4 | |
- name: Test | |
run: go test -v ./... | |
- name: Build | |
run: go build -v -o api ./cmd/api | |
- uses: actions/upload-artifact@v3 | |
with: | |
name: sw-artifact | |
path: ./api | |
deploy: | |
runs-on: ubuntu-20.04 | |
needs: build | |
steps: | |
- uses: actions/checkout@v3 | |
- uses: actions/download-artifact@v3 | |
with: | |
name: sw-artifact | |
- name: Deploy to server | |
uses: appleboy/scp-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
source: ./api | |
target: "/home/${{ secrets.USERNAME }}/chess/swahilichess-api" | |
- name: Start SwahiliChess API service and Reload Nginx | |
uses: appleboy/ssh-action@master | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: | | |
cd /home/${{ secrets.USERNAME }}/chess/swahilichess-api | |
chmod +x api | |
echo ${{ secrets.PASSWORD }} | sudo -S systemctl stop swahiliches-api.service | |
echo ${{ secrets.PASSWORD }} | sudo -S systemctl start swahiliches-api.service | |
echo ${{ secrets.PASSWORD }} | sudo -S systemctl reload nginx | |