diff --git a/.github/workflows/linux.yml b/.github/workflows/linux.yml new file mode 100644 index 00000000..dd51a175 --- /dev/null +++ b/.github/workflows/linux.yml @@ -0,0 +1,60 @@ +name: Compile ZeroBot-Plugin +on: + push: + branches: + - master + release: + types: + - created + +env: + GITHUB_TOKEN: ${{ github.token }} + +jobs: + my-job: + name: Build ZeroBot-Plugin-linux 🚀 + runs-on: ubuntu-latest + steps: + + - name: Set up Go + uses: actions/setup-go@v2 + with: + go-version: 1.15 + + - name: Check out code into the Go module directory + uses: actions/checkout@v2 + + - name: Cache Go + id: cache + uses: actions/cache@v2 + with: + # A list of files, directories, and wildcard patterns to cache and restore + path: ~/go/pkg/mod + key: ${{ runner.os }}-build-${{ hashFiles('**/go.sum') }} + + - name: Tidy Go modules + run: go mod tidy + + - name: Build + run: go build -o artifacts/ZeroBot-Plugin-linux + + - name: Upload Build Artifact + uses: actions/upload-artifact@v2 + with: + # Artifact name + name: ZeroBot-Plugin-linux + # A file, directory or wildcard pattern that describes what to upload + path: ./artifacts + + - name: Gets latest created release info + id: latest_release_info + uses: jossef/action-latest-release-info@v1.1.0 + + - name: Upload asset to github release page + id: upload-release-asset + uses: actions/upload-release-asset@v1 + with: + upload_url: ${{ steps.latest_release_info.outputs.upload_url }} + asset_path: ./artifacts/ZeroBot-Plugin-linux + asset_name: ZeroBot-Plugin-linux + asset_content_type: application/zip \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/windows.yml similarity index 83% rename from .github/workflows/release.yml rename to .github/workflows/windows.yml index b9712cf2..1ccb8c6c 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/windows.yml @@ -12,8 +12,8 @@ env: jobs: my-job: - name: Build ZeroBot-Plugin 🚀 - runs-on: ubuntu-latest + name: Build ZeroBot-Plugin-windows 🚀 + runs-on: windows-latest steps: - name: Set up Go @@ -35,14 +35,14 @@ jobs: - name: Tidy Go modules run: go mod tidy - - name: Build windows - run: export GOOS=windows; export GOARCH=amd64; export CGO_ENABLED=1; go build -ldflags="-s -w -extldflags '-static'" -o artifacts/ZeroBot-Plugin-linux + - name: Build + run: go build -o artifacts/ZeroBot-Plugin-windows.exe - name: Upload Build Artifact uses: actions/upload-artifact@v2 with: # Artifact name - name: ZeroBot-Plugin + name: ZeroBot-Plugin-windows.exe # A file, directory or wildcard pattern that describes what to upload path: ./artifacts diff --git a/go.mod b/go.mod index 16afa1ef..32435b07 100644 --- a/go.mod +++ b/go.mod @@ -6,6 +6,7 @@ require ( github.com/antchfx/htmlquery v1.2.3 github.com/mattn/go-sqlite3 v1.14.6 github.com/sirupsen/logrus v1.8.0 + github.com/t-tomalak/logrus-easy-formatter v0.0.0-20190827215021-c074f06c5816 github.com/tidwall/gjson v1.6.8 github.com/wdvxdr1123/ZeroBot v1.0.1 gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b