From 8f801124296b22b6a9aa89b68cac6fc95906308d Mon Sep 17 00:00:00 2001 From: xun Date: Tue, 5 Sep 2023 22:38:39 +0800 Subject: [PATCH] Create link.yml --- .github/workflows/link.yml | 44 ++++++++++++++++++++++++++++++++++++++ 1 file changed, 44 insertions(+) create mode 100644 .github/workflows/link.yml diff --git a/.github/workflows/link.yml b/.github/workflows/link.yml new file mode 100644 index 0000000..7632122 --- /dev/null +++ b/.github/workflows/link.yml @@ -0,0 +1,44 @@ +# This workflow will build a golang project +# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-go + +name: Go + +on: + push: + branches: [ "main" ] + pull_request: + branches: [ "main" ] + +jobs: + + build: + runs-on: ubuntu-20.04 + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v4 + with: + go-version: '1.20' + + - name: Build + run: go build -o sast-link + + - name: Deploy to Server + uses: easingthemes/ssh-deploy@main + with: + SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }} + ARGS: "-rlgoDzvc -i --delete" + SOURCE: "./sast-link" + REMOTE_HOST: ${{ secrets.REMOTE_HOST }} + REMOTE_USER: ${{ secrets.REMOTE_USER }} + TARGET: ${{ secrets.REMOTE_TARGET }} + - name: Restart sastlink systemctl + uses: appleboy/ssh-action@v1.0.0 + with: + host: ${{ secrets.REMOTE_HOST }} + username: ${{ secrets.REMOTE_USER }} + key: ${{ secrets.SSH_PRIVATE_KEY }} + port: ${{ secrets.PORT }} + script: | + sudo systemctl restart sastlink.service