Skip to content

Backend CI

Backend CI #3

Workflow file for this run

name: Backend CI
on:
workflow_dispatch:
#push:
# branches: [ "master" ]
# paths: [ "miaosha-server/**" ]
#pull_request:
# branches: [ "master" ]
# paths: [ "miaosha-server/**" ]
defaults:
run:
working-directory: ./miaosha-server
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Setup Go environment
uses: actions/setup-go@v4
with:
go-version: '1.13'
go-version-file: './miaosha-server/go.mod'
cache-dependency-path: './miaosha-server/go.sum'
- name: Build
run: |
go mod tidy
CGO_ENABLED=0 GOARCH=amd64 GOOS=linux go build -o ./bin/miaosha ./main.go
- name: Copy file via SCP
run: sshpass -p "${{ secrets.SSH_PASSWORD }}" scp -o StrictHostKeyChecking=no ./bin/miaosha "${{ secrets.SSH_USERNAME }}"@"${{ secrets.SSH_HOST }}":"${{ secrets.DEPLOY_DIR }}"
#- name: Run server
# run: sshpass -p "${{ secrets.SSH_PASSWORD }}" ssh -o StrictHostKeyChecking=no "${{ secrets.SSH_USERNAME }}"@"${{ secrets.SSH_HOST }}" "chmod 777 ${{ secrets.DEPLOY_DIR }}/miaosha && ./miaosha"