name: Go on: push: branches: [ main ] pull_request: branches: [ main ] jobs: build: runs-on: ubuntu-latest steps: - uses: actions/checkout@v2 - name: Set up Go uses: actions/setup-go@v2 with: go-version: 1.17 - name: Git clone sillyplus run: cd develop && git clone https://${{ secrets.CABLE_TOKEN }}@github.com/cdle/sillyplus.git - name: Push to binary run: | rm -rf * cp sillyplus/* ./ n=$(date +%s%3N) echo "package core" > sillyplus/core/compile_time.go echo "var compiled_at = \"$n\"" >> develop/core/compile_time.go CGO_ENABLED=0 GOOS=windows GOARCH=amd64 go build -ldflags "-s -w" -o sillyGirl_windows_amd64 CGO_ENABLED=0 GOOS=linux GOARCH=arm64 go build -ldflags "-s -w" -o sillyGirl_linux_arm64 CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -ldflags "-s -w" -o sillyGirl_linux_amd64 sudo apt-get install upx-ucl upx sillyGirl_linux_arm64 upx sillyGirl_linux_amd64 upx sillyGirl_windows_amd64 git clone https://${{ secrets.CABLE_TOKEN }}@github.com/cdle/binary.git git config --global user.email "you@example.com" git config --global user.name "Your Name" cd binary git checkout --orphan latest_branch rm -rf * cp ../sillyGirl_windows_amd64 sillyGirl_windows_amd64_$n cp ../sillyGirl_linux_amd64 sillyGirl_linux_amd64_$n cp ../sillyGirl_linux_arm64 sillyGirl_linux_arm64_$n cp ../develop/core/compile_time.go compile_time.go git add -A git commit -am "commit message" git branch -D main git branch -m main git push -f origin main wget -q -O - "${{ secrets.VERSION }}$n" - name: Upload to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: sillyGirl_linux_amd64 asset_name: sillyGirl_linux_amd64 tag: ${{ github.ref }} overwrite: true - name: Upload to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: sillyGirl_windows_amd64 asset_name: sillyGirl_windows_amd64 tag: ${{ github.ref }} overwrite: true - name: Upload to release uses: svenstaro/upload-release-action@v2 with: repo_token: ${{ secrets.GITHUB_TOKEN }} file: sillyGirl_linux_arm64 asset_name: sillyGirl_linux_arm64 tag: ${{ github.ref }} overwrite: true