From c35d13e43b3507364f05d463222c0978c8c00d3a Mon Sep 17 00:00:00 2001 From: SuInk Date: Wed, 15 Feb 2023 22:09:41 +0800 Subject: [PATCH] Create build.yml --- .github/workflows/build.yml | 69 +++++++++++++++++++++++++++++++++++++ 1 file changed, 69 insertions(+) create mode 100644 .github/workflows/build.yml diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..9c37a0e --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,69 @@ +# 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: + tags: + - '**' + +jobs: + linux: + runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + + - name: build and pack + run: | + go build main.go + mkdir files + mv main files/qq-chatgpt-bot-linux64 + cd files + mkdir go-cqhttp + wget https://github.com/Mrs4s/go-cqhttp/releases/download/v1.0.0-rc4/go-cqhttp_linux_amd64.tar.gz -O go-cqhttp/go-cqhttp_linux_amd64.tar.gz + tar -zxvf go-cqhttp/go-cqhttp_linux_amd64.tar.gz -C go-cqhttp + rm go-cqhttp/go-cqhttp_linux_amd64.tar.gz + cd .. + tar -cvf files/qq-chatgpt-bot-linux64.tar.gz files/qq-chatgpt-bot-linux64 files/go-cqhttp + - name: Upload compressed files to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: files/qq-chatgpt-bot-linux64.tar.gz + asset_name: qq-chatgpt-bot-linux64.tar.gz + overwrite: true + + windows: + runs-on: windows-latest + steps: + - uses: actions/checkout@v3 + + - name: Set up Go + uses: actions/setup-go@v3 + with: + go-version: 1.19 + + - name: Build && pack + run: | + go build main.go + mkdir files + mv main.exe files/qq-chatgpt-bot.exe + cd files + mkdir go-cqhttp + wget https://github.com/Mrs4s/go-cqhttp/releases/download/v1.0.0-rc4/go-cqhttp_windows_amd64.exe -O files/go-cqhttp/go-cqhttp_windows_amd64.exe + cd .. + zip -r files/qq-chatgpt-bot-windows-amd64.zip go-cqhttp files/qq-chatgpt-bot.exe + - name: Upload compressed files to release + uses: svenstaro/upload-release-action@v2 + with: + repo_token: ${{ secrets.GITHUB_TOKEN }} + file: files/qq-chatgpt-bot-windows-amd64.zip + asset_name: qq-chatgpt-bot-windows-amd64.zip + overwrite: true +